Hey Folks.
Consider this a challenge, kind of.
Given this data in a sql table:
ID % Level
---- ----- -----
AB1 50 4
AB1 100 4
AB1 100 3
AB1 100 2
AB1 100 1
AB2 33 3
AB2 75 2
AB2 100 1
AB3 22 2
AB3 100 1
AB4 100 5
AB4 100 4
AB4 100 3
AB5 100 1
I want to query it in a manor which provides me with the highest value (column 3) where the percent (column 2) is 100. NOTE: there may be multiple items for a lvl, if they are not all 100% then that lvl is not complete. Results I seek in a summary format.
Example results using example data:
Level 5: 1
Level 4: 0
Level 3: 1
Level 2: 0
Level 1: 2
What are your thoughts on the best way to accomplish this? I would prefer a solution that is mostly sql with very little code, but would like to hear all your thoughts.
Thanks for looking!