select a.f1, b.f3 from 
(select f2, count(f1) f1 from tab_1 group by f2) a,
(select f2,f3 from tab_2) b
where a.f2 = b.f2

解决方案 »

  1.   

    select (select count(字段1) from table1 where 字段2=a.字段2),字段3 from table2;
      

  2.   

    sorry:
    select (select count(字段1) from table1 where 字段2=a.字段2),字段3 from table2 a
      

  3.   

    select (select count(字段1) from table1 where 字段2=a.字段2),字段3 from table2 a group by a.字段2
      

  4.   

    按上述方法,oracle 提示ORA-00979: 不是 GROUP BY 表达式 异常信息
    按如下写法得到结果集,不知还有别的什么方法?
    select count(字段1),(select 字段3 from 表2 where 字段2=b.字段2) from 表2 b group by b.字段2