If a store can only be in one region then you don't need a many to many relation expressed by intermediate table store_region. Instead just put a region_id field in store referencing the region table forming a one to many relation from region to store. You may have a reason for a many to many relation that is not stated here but if you don't it makes the solution more complicated than it needs to be which is why I mention it here.
On Sep 23, 11:49 am, rick <ricon...@gmail.com> wrote: > Hi, > I'm having trouble figuring out the syntax for this type of database > inquiry. > I have three tables: > > 1) stores, which has a name > 2) regions, which has a 2-letter abbreviation > 3) store-region, which puts stores in certain regions. > > I want to pass in a 2-letter region abbreviation, > and receive back the names of the stores in that region. > > So I need to use the results of one query (regions with the > abbreviation "NY", say), to get another set of results (store ids > with that region id), to get the third set of results (stores names > that matched the store ids) > > Thanks for reading..