我在数据库上有一个名为“文章”的表
文章:
id +++ writer_id +++ title ++++ text
----------------------------------------------------
1 1 some title article for writer 1
2 1 some title article for writer 1
3 2 some title article for writer 2
4 2 some title article for writer 2
5 2 some title article for writer 2
6 3 some title article for writer 3
我需要一个查询来从表中获取最新文章,但每个作家只有一篇文章
取决于查询上方的行应该只有 3 行:每篇文章由一位作者拥有
2 1 some title article for writer 1
5 2 some title article for writer 2
6 3 some title article for writer 3
php
SELECT *
FROM articles
WHERE writer_id = ???? ;
order by id desc limit 10
提前致谢 : )