1. select
(select count(distinct(Field_1)) from table_1 where Field_3='1')+
(select count(distinct(Field_2)) from table_1 where Field_3='2) cnt
from dual;2.select
count(distinct(decode(Field_3,'1',Field_1))) +
count(distinct(decode(Field_3,'2',Field_1))) cnt
from Table_1;3.假定Field_1,Field_2中都不含有字符 '*',还可以使用
select
count(distinct(decode(Field_3,'1','*' || Field_1, Field2))) cnt
from Table_1;
(select count(distinct(Field_1)) from table_1 where Field_3='1')+
(select count(distinct(Field_2)) from table_1 where Field_3='2) cnt
from dual;2.select
count(distinct(decode(Field_3,'1',Field_1))) +
count(distinct(decode(Field_3,'2',Field_1))) cnt
from Table_1;3.假定Field_1,Field_2中都不含有字符 '*',还可以使用
select
count(distinct(decode(Field_3,'1','*' || Field_1, Field2))) cnt
from Table_1;
没试过,应该行
(select count(distinct(Field_1)) from table_1 where Field_3='1')+
(select count(distinct(Field_2)) from table_1 where Field_3='2) cnt
from dual;
能不能说明一下:cnt是什么意思?dual是什么意思?
(select count(distinct(Field_1)) from table_1 where Field_3='1')+
(select count(distinct(Field_2)) from table_1 where Field_3='2) cnt
from dual;
能不能说明一下:cnt是什么意思?dual是什么意思?
呵,,知道了,不好意思,这么简单扼要!
2、select count(distinct(Field_2)) from table_1 where Field_3='2'select sum(decode(Field_3,'1',