开发者

mysql 4.x -> 5.x upgrade related question

开发者 https://www.devze.com 2023-01-15 13:45 出处:网络
im upgrading mysql 4.x -> 5.x. and in my php source there is mysql synxtax following. $pt_sql = \"select * from orderlist

im upgrading mysql 4.x -> 5.x.

and in my php source there is mysql synxtax following.

$pt_sql = "select * from orderlist 
           where condition!='delete' 
            and lef开发者_如何学Ct(date,10)='$nday' 
           group by id ";

how can i change above mysql syntax to mysql 5.x syntax?

if anyone help me much apprecate!

thanks in advance


CONDITION is a reserved word in MySQL 5.0 (it was not in 4.1) so it must be in backticks in your queries:

select * from orderlist 
where `condition` != 'delete' 
and left(date,10)='$nday' 
group by id

You may also want to consider storing the column date as a date or storing it as datetime type and using the DATE function.

0

精彩评论

暂无评论...
验证码 换一张
取 消