mike2325 Posted February 26, 2011 Share Posted February 26, 2011 Hi, I have a link table with the values Room_Code and Facility_ID from a Room table and a facility table respectively. The Room table contains fields Room_Code, Capacity etc and the Facility table contains Facility_ID and Facility_Type. Therefore the link table for example contains: room code: abc1 Facility_ID:1 room code: abc1 Facility_ID:5 room code: abc1 Facility_ID:6 room code: abc1 Facility_ID:9 room code: jjj1 Facility_ID:1 room code: jjj1 Facility_ID:2 room code: jjj1 Facility_ID:7 room code: jjj1 Facility_ID:9 I wanted to write a sql statement so that the user could select a room that has the Facility_IDs 1, 5 and 6 - so as to search for rooms with those facilities. Any ideas on how to do this as I am confused with searching between the different records. Thanks, Mike Link to comment https://forums.phpfreaks.com/topic/228865-need-help-with-a-sql-statement-in-a-link-table/ Share on other sites More sharing options...
fenway Posted February 26, 2011 Share Posted February 26, 2011 I just posted a solution like this a few days ago -- use a cross join for each condition you want to match. Link to comment https://forums.phpfreaks.com/topic/228865-need-help-with-a-sql-statement-in-a-link-table/#findComment-1180139 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.