select inputtime,count(1),(select count(1) from b where inputtime=a.inputtime) from a group by inputtime
union
select inputtime,count(1),(select count(1) from a where inputtime=b.inputtime) from b group by inputtime

解决方案 »

  1.   

    select inputtime, A表中相应时间的记录数, B表中相应时间的记录数
    (
    select inputtime,count(*) as  A表中相应时间的记录数 ,'' as  B表中相应时间的记录数 from a group by inputtime
    union 
    select inputtime,'' as  A表中相应时间的记录数,count(*) as  B表中相应时间的记录数 from b group by inputtime
    )