日期:2014-05-17 浏览次数:20440 次
就可以 但是 我dm的字段还要关联另外一个表,需要根据dm的信息获取具体的中文名称
SELECT dm,COUNT(1)nmu
FROM (
SELECT *
from [huang]
UNION ALL
SELECT *
FROM [huang2] )a
GROUP BY dm
SELECT * FROM(
SELECT dm,COUNT(1)nmu
FROM (
SELECT *
from [huang]
UNION ALL
SELECT *
FROM [huang2] )a
GROUP BY dm
)as ai left outer join info i on (ai.dm=i.dm)
SELECT ai.*,
(select INFO from info i where ai.dm=i.dm) as info
FROM
(
SELECT dm,COUNT(1)nmu
FROM (
SELECT *
from [huang]
UNION ALL
SELECT *
FROM [huang2] )a
GROUP BY dm
)as ai