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 Quote 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 Quote 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. Quote 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') Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.