I want to select one row each for each distinct value of a column. Here I want to perform it for col1
:
| ID | COL1 | COL2 |
--------------------
| 1 | 0 | 0 |
| 2 | 0 | 1 |
| 3 | 1 | 11 |
| 4 | 1 | 12 |
| 5 | 1 | 16 |
Which results in:
| ID | COL1 | COL2 |
--------------------
| 1 | 0 | 0 |
| 3 | 1 | 11 |
as 0
and 1
were the distinct values for col1
. I am not strict about which row is returned (no need of least value of id, for example) as long as distinct values of column is returned.
Please assume the model is called TestModel
and everything is fully mapped.