我需要計算以下查詢返回的行數。計算select查詢返回的行數
select m.Company_id
from Monitor as m
inner join Monitor_Request as mr on mr.Company_ID=m.Company_id
group by m.Company_id
having COUNT(m.Monitor_id)>=5
我試圖與以下
select COUNT(*) from
(
select m.Company_id
from Monitor as m
inner join Monitor_Request as mr on mr.Company_ID=m.Company_id
group by m.Company_id
having COUNT(m.Monitor_id)>=5)
它給在查詢分析器的錯誤消息,其表示如下:
消息102,級別15,狀態1,行7不正確的語法靠近')'。
是否考慮過@@ ROWCOUNT? – HABO 2012-03-30 15:43:14