I have a table with fields utm and tracking_id. There may be many tracking_ids for each utm.
So I need to select distinct utm and any one tracking id for each utm (let`s say thefirst one).
For example, we got the table:
utm | tracking_id
-------------------
ddff | 1
ddff | 2
llzz | 3
ddff | 4
ohoh | 5
ohoh | 6
And as an output i want to get:
utm | tracking_id
-------------------
ddff | 1
llzz | 3
ohoh | 5
I use PostgreSQL 9.1.
Is there a way to do it with SQL?