I have a data like this below,
id,username,whatevermorecolumns
1,cat,more data here..
2,kitty,..
3,cat,..
4,kitten,..
and want to remove the rows that has duplicated username. so I expect a result like this
id,username,whatevermorecolumns
1,cat,more data here..
2,kitty,..
4,kitten,..
There is a problem which, id 1 or 3, should be removed, maybe, I would love to know that also, but what I'm trying to do is count() the rows after filtering the select result, so not a big problem here.
I googled and read some stackoverflow posts, tried "group by" and "distinct" stuff but still have no good idea about this. maybe because it's postgresql? Thanks for your help.