Hi,
I have a table in SQL like so
| UId | Class |
| 1 | Apple |
| 2 | Apple |
| 3 | Apple |
| 3a | Apple |
| 4 | Orange |
| 4a | Orange |
| 4b | Orange |
| 5 | Orange |
I am trying to get the min and max of the UId column for each class. Is it possible to do so, as the UId is varchar.
Thanks
| UId | Class |
| 1 | Apple |
| 2 | Apple |
| 3 | Apple |
| 3a | Apple |
| 4 | Orange |
| 4a | Orange |
| 4b | Orange |
| 5 | Orange |
Know the answer? Post it. Somebody with the same question will find it here.


Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Nitin SontakkeRank #264 · 9.6K reputationPosted Mar 22, 2018, 12:26 AM EDT
sudipta sanyalRank #1,945 · 753 reputationPosted Mar 22, 2018, 12:27 AM EDT
Joginder BangerRank #360 · 7K reputationPosted Mar 22, 2018, 12:33 AM EDT