晕,这都能不报错?把你表结构给出来,最好给点数据吧。抽时间帮你谢谢select(select count(SubCode)from Speed
where convert(varchar(7),BeginDate,120) = '2012-09' )as spCount,
(select SUM(B.kiloDay)where convert(varchar(7),billdate,120) = '2012-09')as kiloSum,B.SubCode
from Kilo B
left join Speed A
on A.SubCode = B.SubCode
where convert(varchar(7),billdate,120) = '2012-09'
group by B.SubCode,A.SubCode,convert(varchar(7),billdate,120)
select(select count(SubCode)from Speed
where convert(varchar(7),BeginDate,120) = '2012-09' )as spCount,
(select SUM(B.kiloDay)where convert(varchar(7),billdate,120) = '2012-09')as kiloSum,B.SubCode
from Kilo B
left join Speed A
on A.SubCode = B.SubCode
where convert(varchar(7),billdate,120) = '2012-09'
group by B.SubCode,A.SubCode,convert(varchar(7),billdate,120)