DIGIT-ARC read-only archive · snapshot: July 23, 2026

SQL Query Help

3 posts · originally from https://geek.digit.in/community/threads/sql-query-help.35843/

E
enjoy Original post #1
Sep 7, 2006 at 11:09 AM
I have a table "formdetails". Fields (Id, formid, ..., cb)
Id+formid = primary key
cb contains either 0,1 (text)

Each Student (Id) can fill a form multiple times, so each student will have "formid" starting from 1, 2..and so on. (Number of forms per student varies).

I need a list of "Id" which has the highest "formid" and where cb="1"

I mean, I have to consider the tuple for each student which has the highest "formid" for that particular student.

Thanks for your help.
mod-the-pc
Sep 7, 2006 at 7:15 PM
Select
A.id,
A.formid
From
Formdetails A
Where
A.cb='1'
And A.formid=(select Max(b.formid) From Formdetails B Where B.id=a.id)
E
enjoy #3
Sep 8, 2006 at 9:17 AM
Thanks a lot. Will check it and get back.