一个用户发帖的 table,能用一条 sql 选出每个用户最新的那条帖子吗?
例如 table 里的数据:
id userName post postDate
1 AA content1 2017-1-1
2 AA content2 2017-1-2
3 BB content3 2017-1-3
4 BB content4 2017-1-4
sql 选择后,得到结果集:
id userName post postDate
2 AA content2 2017-1-2
4 BB content4 2017-1-4
想了几天,不得其解。
例如 table 里的数据:
id userName post postDate
1 AA content1 2017-1-1
2 AA content2 2017-1-2
3 BB content3 2017-1-3
4 BB content4 2017-1-4
sql 选择后,得到结果集:
id userName post postDate
2 AA content2 2017-1-2
4 BB content4 2017-1-4
想了几天,不得其解。