declare @table_temp TABLE ( total int ,locus nvarchar(100) , carroad nvarchar(100) );
INSERT INTO @table_temp
select count(id) as total, Locus, CarRoad
from cargrasp t
where createtime between cast('2008-08-11 11:27:21' as datetime) and cast('2008-08-14 11:27:21' as datetime)
group by t.locus, t.carroad;
select * from @table_temp
着一句已经通过了,但我真正要达到的目标是:
declare @table_temp TABLE ( total int ,part int, locus nvarchar(100) , carroad nvarchar(100) );
INSERT INTO @table_temp
select count(id) as total, (count(speed = '是'))as part , Locus, CarRoad
from cargrasp t
where createtime between cast('2008-08-11 11:27:21' as datetime) and cast('2008-08-14 11:27:21' as datetime)
group by t.locus, t.carroad;
select * from @table_temp
怎么做呀?请大家帮忙!!!!!!!!!!!!!!!!!!!!!!!!!!!