开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜