表table有a、b、c三列,内容如下
a b c
1 bbb ccc
2 bbb ccc执行下面的语句后一行结果
select max(b),c from table group by c需要一个语句,返回上面那个结果有多少行。
类似count(*)
就这样无名列
1谢谢!!!
a b c
1 bbb ccc
2 bbb ccc执行下面的语句后一行结果
select max(b),c from table group by c需要一个语句,返回上面那个结果有多少行。
类似count(*)
就这样无名列
1谢谢!!!
select count(*)
from (select max(b),c from table group by c)t
create table #test(a int, b varchar(10), c varchar(10))
insert into #test
select 1,'bbb','ccc'
union all select 2, 'bbb', 'ccc'select max(b),c from #test group by cselect @@rowcount-----------
1(1 行受影响)
--
select count(*)from (select max(b),c from table group by c)