SELECT TOP N RECORDS FROM CROSSTAB QUERY

Ann Simmons

New member
Local time
Today, 21:31
Joined
Mar 26, 2022
Messages
11
Hello everyone. How do you select TOP N RECORDS FROM CROSSTAB QUERY? I will be grateful for your assistance. Thanks.
 
Hi. Welcome to AWF!

I agree. What have you tried?
 
Hello everyone. How do you select TOP N RECORDS FROM CROSSTAB QUERY? I will be grateful for your assistance. Thanks.
cross queries are different
the following type is both sorted and selected

Code:
TRANSFORM Count(Students.[ID]) AS [Count-ID]
SELECT Students.[STREAM], Count(Students.[ID]) AS total
FROM Students
GROUP BY Students.[STREAM]
PIVOT year([Birth Date]) in (2000,2001,2004,2005,2006,2007,2008);


Code:
SELECT TOP 2 sg.STREAM, sg.total,
 sg.[2000], sg.[2001], sg.[2004], sg.[2005], sg.[2006], sg.[2007], sg.[2008]
FROM Students_grosstab AS sg
WHERE (((sg.STREAM) Like "[abc]*"))
ORDER BY sg.total DESC;
 

Users who are viewing this thread

Back
Top Bottom