Iluvatar+ Posted June 7, 2012 Share Posted June 7, 2012 I have two tables 'bookings' & 'refnums' in the bookings table i have a foreign key of the 'id' coloum in the 'refnums' tables. I need to query the refnums table so i get all the data from both tables in related order but i need to only bring back the results via a spefic date in the Booking table. I have related both tables in the refnums model but i dont no how to use WHERE condisions to only bring back the results from the bookings.date_booked. Anyone have any ideas. Quote Link to comment https://forums.phpfreaks.com/topic/263810-inner-join-where-clause-in-cakephp/ Share on other sites More sharing options...
gristoi Posted June 8, 2012 Share Posted June 8, 2012 SELECT bookings.*, refnums.* FROM bookings INNER JOIN refnums ON bookings.{whatever the foeign key column is called} = refnums.id WHERE bookings.date_booked = {whatever date you are looking for} ORDER BY refnums.id ASC Quote Link to comment https://forums.phpfreaks.com/topic/263810-inner-join-where-clause-in-cakephp/#findComment-1352115 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.