Oracle 表A上有个字段aa,aa有4种值(1,2,3,4),字段aa如果等于1就查询B1...答:a,b3 where a.aa=b3.id and b3.n=25union allselect a.aa,xx,yy,zz,'b4' table_name from a,b4 where a.aa=b4.id and b4.n=31) twhere t.aa=1或2或3或4类似这样吧,把要查的所有内容都放到子查询里,子查询是各个查询的union all组合,最后通过aa来判断最后的查询结果。
oracle 某个表的字段值是用逗号分隔的,如 a,b,c,我想统计 包含a的有多 ...答:select sum(decode(instr( x_field , 'A'),0,0,1)) a_sum,sum(decode(instr( x_field , 'B'),0,0,1)) b_sum,sum(decode(instr( x_field , 'C'),0,0,1)) c_sum,from x_tab