-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 構文にエラーがあります。near ' を使用する正しい構文については、MySQL サーバーのバージョンに対応するマニュアルを確認してください。Cat_IDLIMIT 0, 16 行目の 30'

4

1 に答える 1

3

news_postsテーブル名とONキーワードがありません。そのはず:

...
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 に答える