I would like to make a field part of a many to many relationship

Posted by jona on Stack Overflow See other posts from Stack Overflow or by jona
Published on 2010-03-08T19:25:51Z Indexed on 2010/03/08 19:36 UTC
Read the original article Hit count: 288

Filed under:

I have the following table called stores

   id     store       zip
   1     Market 1    01569
   2     Market 2    01551
   3     Market 3    10468
   4     Market 4    10435

Zip code table

   INSERT INTO `zip_codes` (`restaurants_locations_id`, `zip`, `state`, `latitude`, `longitude`, `city`, `full_state`) VALUES
(1, '06001', 'CT', ' 41.789698', ' -72.86431', 'Avon', 'Connecticut'),
(2, '06002', 'CT', ' 41.832798', ' -72.72642', 'Bloomfield', 'Connecticut'),
(3, '06010', 'CT', ' 41.682249', ' -72.93365', 'Bristol', 'Connecticut'),
(4, '06013', 'CT', ' 41.758415', ' -72.94642', 'Burlington', 'Connecticut'),
(5, '06016', 'CT', ' 41.909097', ' -72.54393', 'Windsorville', 'Connecticut'),
(6, '06018', 'CT', ' 42.023510', ' -73.31103', 'Canaan', 'Connecticut'),
(7, '06019', 'CT', ' 41.834247', ' -72.89174', 'Canton', 'Connecticut'),

etc....

what I want is to create a table which will connect the zip field in the stores tables where one store will be found in several zicodes...

How would that table would look like?

Thanks

© Stack Overflow or respective owner

Related posts about sql