Q: how to write this

J

JIM.H.

Hello,
I have myTtable and I have ClassID field, now I want to bring myTtable.* for
at most 10 students for each ClassID. There might be more/less than 10 per
ClassID, if there is 10 different ClassID in the database I should be seeing
at most 100 records. How can I write this query?
Thanks,
Jim.
 
M

MGFoster

JIM.H. said:
Hello,
I have myTtable and I have ClassID field, now I want to bring myTtable.* for
at most 10 students for each ClassID. There might be more/less than 10 per
ClassID, if there is 10 different ClassID in the database I should be seeing
at most 100 records. How can I write this query?

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I don't have enough info to create the complete query, but something
like this:

SELECT A.*
FROM myTable As A
WHERE StudentID IN (SELECT TOP 10 StudentID FROM myTable
WHERE ClassID = A.ClassID)
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQnfSZoechKqOuFEgEQLCmACaApPJG76ROcSZgUcGxzY2D3teDUsAn3oc
JruISCsZJ3FPAqe8iIgd9IRt
=xCxD
-----END PGP SIGNATURE-----
 
Top