求sql 语句 返回数字 就像select count(*) from table 一样结果是一个数字

2025-03-07 05:20:48
推荐回答(3个)
回答1:

select count(1) from (select * from aaa where rownum<101) a
where a.zt='2'
group by a.zt

回答2:

declare @cnt int
select @cnt=count(*) from table
print(@cnt)

回答3:

select count(zt) from
(select top 100 * from table )
b where zt='2'