2009-07-09 4 views
25

Lorsque je lance la requête:syntaxe SQL sous_requête serveur

select count(*) from 
(select idCover from x90..dimCover group by idCover having count(*) > 1) 

Je reçois l'erreur:

Server: Msg 170, Level 15, State 1, Line 2 
Line 2: Incorrect syntax near ')' 

Comment puis-je formuler correctement cette requête?

Je suis sur SQL Server 2000

Répondre

38

Ajouter un alias après votre dernier support.

select count(*) from 
(select idCover from x90..dimCover group by idCover having count(*) > 1) a 
14
SELECT COUNT (*) FROM 
(SELECT IdCover FROM x90..dimCover group by idCover having count(*) > 1) AS a 

(notez l'alias à la fin)