oracle decode用法
DECODE(value,if1,then1,if2,then2,if3,then3,...,else)
decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值)
select count() from 表 where 性别 = 男;
select count(
) from 表 where 性别 = 女;
要想显示到一起还要union一下,太麻烦了
用decode呢,只需要一句话
例:select decode(性别,男,1,0),decode(性别,女,1,0) from 表
例:select id,username,age,decode(sex,0,‘男‘,1,‘女‘)
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)))
来源:迅闻网
相关推荐
bianxq 2020-05-16
Streamoutput 2020-04-30
LuoXinLoves 2020-03-26
zhangxiaojiakele 2019-12-21
Nicolase 2019-12-19
us0 2019-09-05
yanghuatong 2013-05-04
不懂 2019-07-07
qiguiting 2019-07-01
CoreyJia 2015-05-29
handle0 2011-03-18
linkincsdn 2013-07-04
87497718 2012-04-18
89367267 2011-09-17
lester 2018-08-31
katnisswuyuechen 2018-12-21
千里之行始于足下 2014-04-22