How can I select ALL ROWS and where A ROW is existent more then once, (based on ID) just take one (doesn't matter which one).
So I have:
ID name val
===========
1 | aa | 32
2 | aa | 32
3 | ad | 32
3 | zy | 11
4 | rr | 21
5 | oi | 44
5 | df | 11
result should be
ID name val
===========
1 | aa | 32
2 | aa | 32
3 | zy | 11
4 | rr | 21
5 | df | 11
It doesn't matter if 5 | df | 11
or 5 | oi | 44
is taken.
On Postgres, SELECT DISTINCT ON ID
would be my choice.
Many thanks in advance