I have a telephone call table and I need to return the 10 longest calls by user last name. Fields used would be lastname and callduration. Callduration you be sorted descending.
Another way:
SELECT lastname, callduration
FROM calltable AS A
WHERE callduration In (SELECT TOP 10 callduration
FROM calltable WHERE lastname=A.lastname ORDER BY 1 DESC)
ORDER BY 1, 2 DESC
Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.