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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.