日期:2014-05-17 浏览次数:20528 次
select * from
(
select pStreet,count(distinct pComname) comnameNum
from tbl_Product
where pStreet in (select distinct pStreet from tbl_Product)
group by pStreet
union all
select distinct pComname,count(cTime) cTimeNum
from tbl_Condition
where cTime is not null
group by pComname
union all
select '',COUNT(distinct pComname)
from tbl_Condition
) t
SELECT MAX(pStreet) pStreet ,
SUM(comnameNum) comnameNum ,
MAX(pComname) pComname ,
SUM(cTimeNum) cTimeNum ,
SUM(pComname) pComname
FROM ( SELECT pStreet ,
COUNT(DISTINCT pComname) comnameNum ,
NULL AS pComname ,
0 AS cTimeNum ,
0 AS pComname
FROM tbl_Product
WHERE pStreet IN ( SELECT DISTINCT
pStreet
FROM&nbs