I have something i need to do and i don't know how to do it :)
I have the following data :
Art | Type |
---|---|
2215 | Z |
2215 | C |
2215 | M |
2216 | C |
2216 |
The result i want to have
Art | Type |
---|---|
2215 | M |
2216 | C |
Those data come from a query with a group by (let say it's the data from multiple store and some store have a different "Type" than other).
What i need to do is to be able to get only one row by "Art" but with the best "Type" ("Type" = to the cashback for a Customer)
I need to take the "Type" in that order
- M
- C
- Z
How can i put it in my T-SQL statement ? I can still do something later in .NET but i would rather put everything in the SQL Statement.
Thank you for your help :)