I have a user table like below. How can I get only non duplicate records for each username
? e.g. for username = AAA
, I only want to get the row with id = '1'
and id ='5'
, and for username = BBB
the row with id = '2'
.
id email username
1 [email protected] AAA
2 [email protected] BBB
3 [email protected] CCC
4 [email protected] AAA
5 [email protected] AAA