2009-07-09 13 views
25

Kiedy uruchomić kwerendę:podzapytanie SQL Server składnia

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

I pojawia się błąd:

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

Jak sformułować zapytanie poprawnie?

jestem na SQL Server 2000

Odpowiedz

38

Dodaj alias po ostatnim wsporniku.

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 

(zauważ alias na końcu)