Shadowing Posted July 31, 2012 Share Posted July 31, 2012 Hey guys getting hit with a error that i cant figure out #1064 - 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 'AS result' at line 6 SELECT (400 + ((2 - 1) * 600)) + ((400 + ((4 - 1) * 600)) - (400 + ((2 - 1) * 600)) * (1 - (((1343715769 - 1343715694) - (1343715814 - 1343715694)) / (1343715769 - 1343715694))) - (CEIL((400 + ((2 - 1) * 600)) + ((400 + ((4 - 1) * 600)) - (400 + ((2 - 1) * 600))) / 600)) AS result Link to comment https://forums.phpfreaks.com/topic/266482-syntax-error-with-sql-math/ Share on other sites More sharing options...
memfiss Posted July 31, 2012 Share Posted July 31, 2012 one more ) before AS result SELECT (400 + ((2 - 1) * 600)) + ((400 + ((4 - 1) * 600)) - (400 + ((2 - 1) * 600)) * (1 - (((1343715769 - 1343715694) - (1343715814 - 1343715694)) / (1343715769 - 1343715694))) - (CEIL((400 + ((2 - 1) * 600)) + ((400 + ((4 - 1) * 600)) - (400 + ((2 - 1) * 600))) / 600))) AS result; +----------+ | result | +----------+ | 598.0000 | +----------+ 1 row in set (0.00 sec) Link to comment https://forums.phpfreaks.com/topic/266482-syntax-error-with-sql-math/#findComment-1365643 Share on other sites More sharing options...
Christian F. Posted July 31, 2012 Share Posted July 31, 2012 Just for your information, but there's a lot of unnecessary parentheses there, which you could with great success remove. Would make it a lot easier to keep track of them all, and avoid such problems in the future. Link to comment https://forums.phpfreaks.com/topic/266482-syntax-error-with-sql-math/#findComment-1365684 Share on other sites More sharing options...
Shadowing Posted July 31, 2012 Author Share Posted July 31, 2012 I figured out a way i can shrink the math a little more by doing some of the math on a insert but ya i should put it in one 1 so i can at least see it better lol Link to comment https://forums.phpfreaks.com/topic/266482-syntax-error-with-sql-math/#findComment-1365783 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.