升级后SQL语法错误

时间:2017-12-13 10:46:55

标签: php mysql sql upgrade

我正在将网站/数据库移动到新服务器并进行升级并收到以下错误:

  

您的SQL语法有错误;查看与您的MySQL服务器版本相对应的手册,以便在' AND MONTH(DateCaught)= ORDER BY DateCaughtName ASC'附近使用正确的语法。在第1行

有问题的代码是:

if ($selmonth == "0"):
    $query_rsReports = "SELECT `DateCaught` , `Name` , `Boat` , cr.`Species` , `Weightlb` , `Weightoz` , `lb`, `oz`";
    $query_rsReports .= "FROM `CatchReport` cr, `SpecimenWeight` sw ";
    $query_rsReports .= "WHERE sw.species = cr.species AND  YEAR(`DateCaught`)=$selyear ORDER BY `DateCaught`,`Name` ASC";
else:
    $query_rsReports = "SELECT `DateCaught` , `Name` , `Boat` , cr.`Species` , `Weightlb` , `Weightoz` , `lb`, `oz`";
    $query_rsReports .= "FROM `CatchReport` cr, `SpecimenWeight` sw ";
    $query_rsReports .= "WHERE sw.`Species` = cr.`Species` AND  YEAR(`DateCaught`)=$selyear AND MONTH(`DateCaught`)=$selmonth ORDER BY `DateCaught`,`Name` ASC"; 
endif;

任何关于问题是什么的建议都会非常感激 - 我确定它很简单,但是我找不到它但却无法发现它!

0 个答案:

没有答案