select
a.question字段,
sum(case b.df3 when 'x' then 1 else 0 end) as 严重问题个数,
count(a.df1) as 纪录总和
from table2 a,table1 b
where a.df1=b.df1
group by a.question字段
a.question字段,
sum(case b.df3 when 'x' then 1 else 0 end) as 严重问题个数,
count(a.df1) as 纪录总和
from table2 a,table1 b
where a.df1=b.df1
group by a.question字段
谢谢,您说的可以实现,,
同时还想再问一下,如果表2数据中有重复的,又当如何去掉重复,DISTINCT 无法使用....