Jump to content

Query Question


wemustdesign

Recommended Posts

I have 3 tables for my website, Locations, Attractions and Location_Attractions (stores which attractions can be found at the different locations)

 

I am

Locations
id   name
1    Las Vegas

Attractions
id   name
1    Casino
2    Hotel

Location_Attractions
location_id    attraction_id
1                   1
1                   2

 

trying to get my head round how I perform a query to show which locations a certain attraction can be found at. For example on the Casino page I am going to list oll of the locations this can be found at.

 

So I know I need to query Location_Attractions to find all of the locations that have the correct attraction_id (eg 1 for Casino). I then need to link this to the Locations table to retrieve the details about the locations (such as name, address). Any idea how I would do this, would I use a JOIN?

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/242477-query-question/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.