看看对不对:select id as '识别号',mc as '名称',sbrq,xse,kprq,se 
from table1 a
     (select id,sum(xse) xse,sbrq from table2 where substr(to_char(sbrq,'yyyy-mm-dd'),6,2)=substr(to_char(sysdate,'YYYY-mm-dd'),6,2) group by id,sbrq) b
     (select id,sum(se) se,kprq from table3 where substr(to_char(sbrq,'yyyy-mm-dd'),6,2)=substr(to_char(sysdate,'YYYY-mm-dd'),6,2) group by id,kprq) c
where a.id=b.id and a.id=c.id

解决方案 »

  1.   

    基本正确了,有点问题:因为按sbrq/kprq分组,而不是按【月】分组,所以当同月不同天数的记录不能分组出来,会造成数据记录的叠加!group by id,to_char(kprq,'MM')?
      

  2.   

    还有,此查询仅列出table2/table3中都有的记录,没能列出只table2/table3一表中有,另一表中无的数据,如要列出,该怎样做?