SQL Server subquery syntax

后端 未结 2 1576
一生所求
一生所求 2021-01-07 17:01

When I run the query :

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

I get the error :

相关标签:
2条回答
  • 2021-01-07 17:36

    Add an alias after your last bracket.

    select count(*) from 
    (select idCover from x90..dimCover group by idCover having count(*) > 1) a
    
    0 讨论(0)
  • 2021-01-07 17:37
    SELECT COUNT (*) FROM
     ( SELECT IdCover FROM x90..dimCover group by idCover having count(*) > 1) AS a
    

    (note the alias at the end)

    0 讨论(0)
提交回复
热议问题