I’m sorry, my SQL is a bit rusty so this might be trivial, but I can’t figure it out.
I have table data similar to this:
ID LABEL
101 A
102 A
103 A
104 B
105 C
106 C
I’d like to select only distinct labels, but also have a column with ids. Ideally result could be:
ID LABEL
101 A
104 B
105 C
I don’t really care which ID gets selected for a label. Less ideally id could any unique integer, like this:
ID LABEL
1 A
2 B
3 C
I’m using SQLite, if that matters.
This query will do the trick and select you the min id for each label. You just need to put in the name of your table…