I have a table with the following data:
TableColumnsId AssumedDataType Ranking
43264 System_String 1
43265 System_Int32 2
43265 System_Double 10
43266 System_Double 10
43266 System_Int32 2
43267 System_Int32 2
43267 System_Double 10
43268 System_Double 9
43268 System_Int32 8
43268 System_String 9
43269 System_String 9
43269 System_Int32 7
43269 System_Double 10
43270 System_String 5
43271 System_String 1
43272 System_String 8
43272 System_Double 4
I want to return only one column per TableColumnsId and the summary AssumedDataType should be the one with the lower rank.
Therefore the above data should become:
TableColumnsId AssumedDataType Ranking
43264 System_String 1
43265 System_Int32 2
43266 System_Int32 2
43267 System_Int32 2
43268 System_Int32 8
43269 System_Int32 7
43270 System_String 5
43271 System_String 1
43272 System_Double 4
If I use the min aggregate function with a group by it returns the first AssumedDataType alphabetically which won't work.