Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Nested Sql Query

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-31 : 10:00:20
Luca writes "I would like to run the following nested query using MS Access:

Query to be run first (called AGGREGA):

SELECT DatiIndagine.R4A as Risposta
FROM DatiIndagine
WHERE [DatiIndagine.R4A] Is Not Null
UNION ALL SELECT DatiIndagine.R4B as Risposta
FROM DatiIndagine
WHERE [DatiIndagine.R4B] Is Not Null
UNION ALL SELECT DatiIndagine.R4C as Risposta
FROM DatiIndagine
WHERE [DatiIndagine.R4C] Is Not Null

Query to be run once the AGGREGA has been run:

SELECT Aggrega.Risposta, Count(Aggrega.Risposta) AS Totale_Risposte
FROM Aggrega
GROUP BY Aggrega.Risposta
ORDER BY Count(Aggrega.Risposta) DESC

Can you suggest how I can code this in order to create a recordset? Can I do it with a single SQL statement? If yes, how?

Thank you,

Luca"
   

- Advertisement -