-1
SELECT `news_posts`.`ID` , `category`.`ID` , `news_posts`.`Title` , `news_posts`.`Author` , `news_posts`.`Time` , `news_posts`.`Cat_ID` , `news_posts`.`Tags` , `news_posts`.`imageLocation` , `news_posts`.`thumbLocation` , `category`.`name`
FROM `news`.`category`
LEFT JOIN `category`.`ID` = `news_posts`.`Cat_ID`
LIMIT 0 , 30

这是它带来的错误

1064 - 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以了解在 '. Cat_IDLIMIT 0, 30' 在第 16 行

4

1 回答 1

3

您缺少表名news_postsON关键字。它应该是:

...
FROM `news`.`category`
LEFT JOIN news_posts ON `category`.`ID`  ...
...

像这样:

SELECT 
  `news_posts`.`ID` , `category`.`ID` , 
  `news_posts`.`Title` , `news_posts`.`Author` , 
  `news_posts`.`Time` , `news_posts`.`Cat_ID` , 
  `news_posts`.`Tags` , `news_posts`.`imageLocation` , 
  `news_posts`.`thumbLocation` , `category`.`name`
FROM `news`.`category`
LEFT JOIN news_posts ON `category`.`ID` = `news_posts`.`Cat_ID`
LIMIT 0 , 30
于 2012-12-14T17:50:34.453 回答