RZero Posted June 16, 2009 Share Posted June 16, 2009 Hi there I am running this simple query $MySQL ="SELECT * FROM extensions WHERE dept ='7'"; $res1 = mysql_query($MySQL); $ext = array(); $name = array(); while ($extension = mysql_fetch_array($res1)) { $ext[] = $extension['ext']; $name[] = $extension['Name']; $startdate = 86400 * 7; $mysql = "select concat(DAY(calldate) ,'/', MONTH(calldate),'/' ,YEAR(calldate)) as thisday, count(src) as calls from cdr where src in ('".implode("', '", $ext)."') and calldate > 604800 group by thisday" Which when I run in MySql looks like this select concat(DAY(calldate) ,'/', MONTH(calldate),'/' ,YEAR(calldate)) as thisday, count(src) as calls from cdr where src in ('554', '639', '646', '656', '675', '676', '681', '690', '691', '696', '580', '581', '566', '576', '586', '590', '574', '588', '518') and calldate > 604800 group by thisday Which is correct but it only runs fine on one server running MySql 5 and I get this error #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 '( calldate ) , '/' , MONTH( calldate ) , '/' , YEAR( calldate ) when trying to run it on MySql 4 I have checked the SQL manuals and I can not see any difference between the two servers. ??? Quote Link to comment https://forums.phpfreaks.com/topic/162402-solved-concat-different-between-mysql-4-and-5/ Share on other sites More sharing options...
fenway Posted June 16, 2009 Share Posted June 16, 2009 Which version of 4? Quote Link to comment https://forums.phpfreaks.com/topic/162402-solved-concat-different-between-mysql-4-and-5/#findComment-857388 Share on other sites More sharing options...
RZero Posted June 17, 2009 Author Share Posted June 17, 2009 Which version of 4? Sever 4.0.24 Client 4.1.22 Quote Link to comment https://forums.phpfreaks.com/topic/162402-solved-concat-different-between-mysql-4-and-5/#findComment-857820 Share on other sites More sharing options...
fenway Posted June 18, 2009 Share Posted June 18, 2009 Yup... DAY() was added in v4.1.1 -- use DAYOFMONTH() instead, it's the same function. Quote Link to comment https://forums.phpfreaks.com/topic/162402-solved-concat-different-between-mysql-4-and-5/#findComment-859037 Share on other sites More sharing options...
RZero Posted June 19, 2009 Author Share Posted June 19, 2009 Yup... DAY() was added in v4.1.1 -- use DAYOFMONTH() instead, it's the same function. Cheers Fenway Quote Link to comment https://forums.phpfreaks.com/topic/162402-solved-concat-different-between-mysql-4-and-5/#findComment-859521 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.