ballhogjoni Posted December 16, 2008 Share Posted December 16, 2008 SELECT sum(o.total) FROM travel_orders o WHERE o.company_id = '12' AND (o.charge_date BETWEEN 1167627600 AND 1197781200) error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 Link to comment https://forums.phpfreaks.com/topic/137224-solved-whats-wrong-with-this-query/ Share on other sites More sharing options...
Maq Posted December 16, 2008 Share Posted December 16, 2008 You don't need the () around the between clause. SELECT sum(o.total) FROM travel_orders o WHERE o.company_id = '12' AND o.charge_date BETWEEN 1167627600 AND 1197781200 Link to comment https://forums.phpfreaks.com/topic/137224-solved-whats-wrong-with-this-query/#findComment-716857 Share on other sites More sharing options...
ballhogjoni Posted December 16, 2008 Author Share Posted December 16, 2008 Nope thats what I thought too. Still doesn't work. Link to comment https://forums.phpfreaks.com/topic/137224-solved-whats-wrong-with-this-query/#findComment-716862 Share on other sites More sharing options...
Maq Posted December 16, 2008 Share Posted December 16, 2008 Hmm, not sure. It looks correct to me, maybe add single quotes? SELECT sum(o.total) FROM travel_orders o WHERE o.company_id = '12' AND (o.charge_date BETWEEN '1167627600' AND '1197781200') Link to comment https://forums.phpfreaks.com/topic/137224-solved-whats-wrong-with-this-query/#findComment-716873 Share on other sites More sharing options...
ballhogjoni Posted December 16, 2008 Author Share Posted December 16, 2008 wow good suggestion, it worked Link to comment https://forums.phpfreaks.com/topic/137224-solved-whats-wrong-with-this-query/#findComment-716880 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.