询问:
mysql> SELECT DISTINCT (stories.id), stories.news_type, story_keywords.keyword
FROM (`stories`) LEFT JOIN `story_keywords` ON `stories`.`id`
=`story_keywords`.`story_id`
WHERE `image_full_url` != '' AND `order` != 0
AND `news_type` IN ('movie_review', 'movie')
AND `keyword` IN ('topnews', 'toptablet')
ORDER BY `created` DESC, `order` DESC LIMIT 5;
结果:(请注意 ID 不是不同的)
+--------+--------------+-----------+
| id | news_type | keyword |
+--------+--------------+-----------+
| 100895 | movie_review | topnews |
| 100895 | movie_review | toptablet |
| 100798 | movie_review | toptablet |
| 100060 | movie_review | toptablet |
| 100060 | movie_review | topnews |
+--------+--------------+-----------+
5 rows in set (0.00 sec)