【发布时间】:2020-08-30 07:09:31
【问题描述】:
我有一个如下所示的用户表。如何仅获取每个 username 的非重复记录?例如对于username = AAA,我只想得到id = '1' 和id ='5' 的行,对于username = BBB,我只想得到id = '2' 的行。
id email username
1 test1@test.com AAA
2 test1@test.com BBB
3 test2@test.com CCC
4 test1@test.com AAA
5 test2@test.com AAA
【问题讨论】:
标签: mysql sql database select greatest-n-per-group