My today’s problem is that I have a table that has rows like that:
ID NAME NUMBER IDN
1 dsad 500600 12
1 dsad 600700 13
2 kkkk 111222 56
2 kkkk 333232 57
in one ID example 1 i have 2 identical names 2 different numbers and different IDN.
What i want is to extract single row For each Id where the idn value is the smaller one.
So I want to have sommething like that
1 dsad 500600 12
2 kkkk 111222 56
Is it posible to write a single sql to have that result? I tried to group that by ID and NAME and have the min(IDN) but I’m stuck with the number field 🙂 any ideas?
You were almost there, just add the
MIN(Number)field.In response to comment
Following would get you the records with the
MIN(IDN), regardless what the number for that specific record is.