dannyone Posted March 29, 2009 Share Posted March 29, 2009 hello everyone i have a problem, i have got 3 working querys, to show on seperate tables, however i need to either combine these 3 querys to show all the information in one table, or i need to run the querys straight after each other so i can do it. my aim is to show a table of all the times that are available for 3 selected rooms. the 3 querys i have work , seperatly, but i dont know how to join them. can any one help here are my 3 working querys "SELECT Marker_Rooms.Room_ID, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE Marker_ID = '" .$_SESSION['login'] . "' AND Marker_Rooms.Room_ID = Rooms_Free.Room_ID AND Rooms_Free.status = '0'" SELECT Marker_Rooms.Room_ID1, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE Marker_ID = '" .$_SESSION['login'] . "' AND Marker_Rooms.Room_ID1 = Rooms_Free.Room_ID AND Rooms_Free.status = '0'" "SELECT Marker_Rooms.Room_ID2, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE Marker_ID = '" .$_SESSION['login'] . "' AND Marker_Rooms.Room_ID2 = Rooms_Free.Room_ID AND Rooms_Free.status = '0'" Here is a query i tried but it just displays all records in the table regardless is they have status 0 or not. "SELECT Marker_Rooms.Room_ID, Marker_Rooms.Room_ID1, Marker_Rooms.Room_ID2, Rooms_Free.Room_ID, Rooms_Free.timeslot, Rooms_Free.day, Rooms_Free.status FROM Marker_Rooms, Rooms_Free WHERE (Marker_Rooms.Room_ID = Rooms_Free.Room_ID AND Marker_Rooms.Marker_ID = '" .$_SESSION['login'] . "' AND Rooms_Free.status = '0') OR (Marker_Rooms.Room_ID1 = Rooms_Free.Room_ID AND Marker_Rooms.Marker_ID = '" .$_SESSION['login'] . "' AND Rooms_Free.status = '0') OR (Marker_Rooms.Room_ID2 = Rooms_Free.Room_ID AND Marker_Rooms.Marker_ID = '" .$_SESSION['login'] . "' AND Rooms_Free.status = '0')" any help would be fantastic Thanks Quote Link to comment https://forums.phpfreaks.com/topic/151629-solved-complex-query-help/ Share on other sites More sharing options...
dannyone Posted March 29, 2009 Author Share Posted March 29, 2009 ok i have sorted it now thanks anyways Quote Link to comment https://forums.phpfreaks.com/topic/151629-solved-complex-query-help/#findComment-796339 Share on other sites More sharing options...
fenway Posted April 1, 2009 Share Posted April 1, 2009 ok i have sorted it now thanks anyways You've not helped anyone but yourself... could you post the solution for the rest of us? Quote Link to comment https://forums.phpfreaks.com/topic/151629-solved-complex-query-help/#findComment-798569 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.