Jump to content

Inner Join help


dannyone

Recommended Posts

hello everyone i have a rather complex query that i am trying to make but i just can't figure out how im going to do it, here is my table structure

 

Marker_Free table

Marker_ID, timeslot, day, status

 

Marker_Rooms table

Marker_ID, Room_ID

 

Rooms_Free table

Room_ID, timeslot, day, status

 

now what i need to do is compare all the data in these tables and show them in a html table. i have attempted to do the query and i can get it to display the room availability for tht user, but i also want it to show that markers availability on the same table. i have two seperate querys that do these, but i need to make them into 1 so i can show all the results. can some1 have a look and try and help me combine the queries so that it works. any help would be greatly appreciated!

 

this code displays Room availability for the user

"SELECT
Mf.Marker_ID, 
Mf.timeslot,
Mf.day,
Mf.Status,
Rf.Room_ID,
Rf.timeslot,
Rf.day,
Rf.status,
Mr.Marker_ID,
Mr.Room_ID
FROM 
Marker_Free AS Mf
INNER JOIN
Marker_Rooms AS Mr
ON (Mf.Marker_ID = Mr.Marker_ID)
INNER JOIN
Rooms_Free AS Rf
ON (Mr.Room_ID = Rf.Room_ID)
WHERE 
Mf.Marker_ID = '" .$_SESSION['login'] . "'");

 

this code displays that Markers availability

 

"SELECT
Marker_ID, 
timeslot,
day,
Status
FROM 
Marker_Free
WHERE 
Marker_ID = '" .$_SESSION['login'] . "'");

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/150784-inner-join-help/
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.