Q: how to write this

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top