I have a table like this:
Field1 | Field2 | Field3
1 | 1 | 22
1 | 2 | 10
2 | 5 | 40
2 | 2 | 55
I want to group by Field1, and then take the values from the rest of the row with the minimal Field2, eg:
Field1 | Field2 | Field3
1 | 1 | 22
2 | 2 | 55
Note that this is not the same as selecting the minimum of each row, which would give:
Field1 | Field2 | Field3
1 | 1 | 10
2 | 2 | 40
Which with my data would be a meaningless result.
Does anyone have a general (ie. multi database) solution to this? I'm sure it must be a solved problem!
I could really do with a solution that works in both sqlite and ms-access, and sql server would be a bonus.