DECODE(value,if1,then1,if2,then2,if3,then3,...,else)ide
decode(條件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)code
select count() from 表 where 性別 = 男;
select count() from 表 where 性別 = 女;
要想顯示到一塊兒還要union一下,太麻煩了
用decode呢,只須要一句話
例:select decode(性別,男,1,0),decode(性別,女,1,0) from 表get
例:select id,username,age,decode(sex,0,'男',1,'女')it
select * from wv_zmm_get_vendor_base t
where
t.ktokk != 'Z011' and t.bukrs = decode($gsdm$,2,8000,decode($gsdm$,3,8010,decode($gsdm$,4,8080,0)))io