select a=(
select sum(a.p01005) as '11:00--12:59'
from
(select p01005 = sum(b.p01105),c.dsc as 时间段 from p010 a,p011 b ,timepart c where a.p01001 = b.p01001
and datepart(hh,a.p01004)> > 10 and datepart(hh,a.p01004) <=12 and c.a12004 = datepart(hh,a.p01004)
group by c.dsc) A )
,b=(
select sum(a.p01005) as '00:00--10:59'
from
(select p01005 = sum(b.p01105),c.dsc as 时间段 from p010 a,p011 b ,timepart c where a.p01001 = b.p01001
and datepart(hh,a.p01004)> = 0 and datepart(hh,a.p01004) <=10 and c.a12004 = datepart(hh,a.p01004)
group by c.dsc) A
)
(
select sum(a.p01005) as '00:00--10:59'
from
(select p01005 = sum(b.p01105),c.dsc as 时间段 from p010 a,p011 b ,timepart c where a.p01001 = b.p01001
and datepart(hh,a.p01004)> = 0 and datepart(hh,a.p01004) <=10 and c.a12004 = datepart(hh,a.p01004)
group by c.dsc) A
) as '00:00--10:59',
(
select sum(a.p01005) as '11:00--12:59'
from
(select p01005 = sum(b.p01105),c.dsc as 时间段 from p010 a,p011 b ,timepart c where a.p01001 = b.p01001
and datepart(hh,a.p01004)> > 10 and datepart(hh,a.p01004) <=12 and c.a12004 = datepart(hh,a.p01004)
group by c.dsc) A ) as '11:00--12:59'