matt.sisto Posted May 6, 2009 Share Posted May 6, 2009 Hi all I am trying to write an sql statement that will retrieve all the stored data necessary to compile an invoice. SELECT event_id, event_start, event_end, fee FROM calendar_events WHERE event_start = '2009-06-01' AND event_end = '2009-06-30' CROSS JOIN client USING (client_id) WHERE org_id = '9' Any help appreciated, thanks and regs. Link to comment https://forums.phpfreaks.com/topic/157068-solved-whats-wrong-with-my-cross-join/ Share on other sites More sharing options...
kickstart Posted May 6, 2009 Share Posted May 6, 2009 Hi Something like:- SELECT event_id, event_start, event_end, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE event_start = '2009-06-01' AND event_end = '2009-06-30' AND org_id = '9' All the best Keith Link to comment https://forums.phpfreaks.com/topic/157068-solved-whats-wrong-with-my-cross-join/#findComment-827384 Share on other sites More sharing options...
matt.sisto Posted May 6, 2009 Author Share Posted May 6, 2009 SELECT event_id, event_start, event_end, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start = '2009-06-01' AND calendar_events.event_end = '2009-06-30' AND client.org_id = '9' I have modified it to this but it is returning an empty result. ??? Link to comment https://forums.phpfreaks.com/topic/157068-solved-whats-wrong-with-my-cross-join/#findComment-827387 Share on other sites More sharing options...
kickstart Posted May 6, 2009 Share Posted May 6, 2009 Hi Is there definitely matching data in the tables? Can you post the table layouts? All the best Keith Link to comment https://forums.phpfreaks.com/topic/157068-solved-whats-wrong-with-my-cross-join/#findComment-827391 Share on other sites More sharing options...
matt.sisto Posted May 6, 2009 Author Share Posted May 6, 2009 I have sorted it now, thanks for your help: <?php $sql = "SELECT event_id, event_start, event_end, fee FROM calendar_events CROSS JOIN client USING (client_id) WHERE calendar_events.event_start >= '".$invoice_start."' AND calendar_events.event_end <= '".$invoice_end."' AND client.org_id = '".$org_id."'"; ?> Link to comment https://forums.phpfreaks.com/topic/157068-solved-whats-wrong-with-my-cross-join/#findComment-827403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.