0

SQL 语句无效。您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以在第 5 行的 'nmc_cd.CDTitle LIMIT 0 , 30' 附近使用正确的语法

'$sql = "SELECT nmc_cd.CDTitle, nmc_cd.CDYear, nmc_cd.CDPrice, nmc_category.catDesc, nmc_publisher.pubName
FROM nmc_cd
NATURAL JOIN nmc_category
NATURAL JOIN nmc_publisher
ORDERBY nmc_cd.CDTitle
LIMIT 0 , 30";'
4

2 回答 2

2

由于以下原因,您有语法错误ORDERBY

...
NATURAL JOIN nmc_publisher 
ORDERBY nmc_cd.CDTitle LIMIT 0 , 30"
  /\
  Here

不是ORDER BYORDERBY试试这个:

SELECT 
  nmc_cd.CDTitle, 
  nmc_cd.CDYear, 
  nmc_cd.CDPrice, 
  nmc_category.catDesc, 
  nmc_publisher.pubName 
FROM nmc_cd 
NATURAL JOIN nmc_category 
NATURAL JOIN nmc_publisher 
ORDER BY nmc_cd.CDTitle LIMIT 0 , 30"
于 2012-12-11T08:30:08.000 回答
0
SELECT nmc_cd.CDTitle, nmc_cd.CDYear, nmc_cd.CDPrice, nmc_category.catDesc, nmc_publisher.pubName FROM nmc_cd NATURAL JOIN nmc_category NATURAL JOIN nmc_publisher
ORDER BY nmc_cd.CDTitle LIMIT 0 , 30

ORDER BY改为使用ORDERBY

于 2012-12-11T08:34:23.867 回答