I want to get the first row for every GV(TeacherID)
GV | Class| SUM
GV1| L001 | 5000
GV1| L002 | 5000
GV1| L003 | 5000
GV2| L002 | 7000
GV2| L003 | 7000
GV2| L001 | 7000
GV3| L001 | 8000
GV3| L002 | 8000
GV3| L003 | 8000
Help me.
Edit: ok, now you’ve edited the question such that this answer looks completely irrelevant…sigh…I’ll leave it in case it helps you get started. Cheers.
The simplest solution given your specs:
If you need other information in addition to the
teacherid:Caveat emptor: I don’t have an installation of SQL-Server handy to test on, so syntax may not be exactly correct; but it’s close.