我有这个查询,我想在按模块排序时从复杂的连接中获取最新和最新的文章。
我对 stackoverflow 大师的问题如下。
是否可以通过按日期排序的模块 id 带来最新(只有一篇)文章?
SELECT *
FROM articles Article
LEFT JOIN sources Source ON Article.source_id = Source.id
RIGHT JOIN app_sources asrc ON asrc.source_id = Source.id
/*GROUP BY asrc.module*/ -> if I enable this i get only one but no order by date
ORDER BY asrc.module ASC, Article.published_at DESC
这是我的第一个问题,我希望我的格式正确!非常感谢
目前是这样的(2k结果)
published_at title module
2012-08-22 12:16:41 | Archos Gen10: Tablet Productivity | 1
2012-08-22 12:13:22 | Vail Resorts Ski App Gets Racing With Lindsey Vonn | 1
2012-08-22 11:58:06 | The Internet a Decade Later [INFOGRAPHIC] | 1
我想要这样
published_at title module
2012-08-15 14:37:40 | The Air Force’s New Ultra-Fast Jet Has an Epic Fai... | 1
2012-01-13 16:17:51 | Canada’s Helium Digital shows us the thinnest iPad... | 2
2012-01-13 14:40:14 | ESPN Feels Lonely: A Chat Regarding ESPN’s Role In... | 3