2010-09-11 50 views
1

即時升級mysql 4.x - > 5.x.mysql 4.x - > 5.x升級相關問題

並在我的PHP源代碼中有以下的mysql synxtax。

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

如何將以上mysql語法更改爲mysql 5.x語法?

如果有人幫我非常感謝!

在此先感謝

+1

它不是SQL查詢,而是PHP代碼。請提供一個SQL查詢以及確切的錯誤消息。 – 2010-09-11 17:56:37

回答

2

CONDITION是在MySQL 5.0(it was not in 4.1)一reserved word所以它必須在反引號在查詢:

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

您可能還需要考慮存儲列date作爲date或將其存儲爲datetime類型並使用DATE函數。