请教一个简单的SQL语句,解决马上结分。 SELECT title,input_date,author,decode(isactive,0,'是',1,'否','其它') sign from impnote; 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 能解释一下decode里面的参数吗,还有sign是什么意思? decode(isactive,0,'是',1,'否','其它') 如果isactive的值=0,返回:'是'如果isactive的值=1,返回:'否'其它值,返回:'其它'sign(n) 如果n>0 return 1,n<0 return -1,n=0 return 0. decode 第一个参数 字段名第二个 第一个用来比较的值其实相当于这样一个if(inactive =0) then sign='是'else if(inactive=1) then sign= '否'else='其它'sign是命名最后结果的字段名 呵呵,我以为是问我sign()函数的用法呢上面的语句中 sign是我随便写的一个 列的别名。 我最后写成这样搞定的 谢谢大家帮忙。select title,input_date,author,isactive from (select title,input_date,author,decode(isactive,0,'是',1,'否') as isactive from impnote) oracle学习资料 exp问题 为什么使用内部函数能够提高sql的执行效率 求oracle sql好书 关于oracle 的union操作 如何进行树形查询? 高人请进!linux系统下oracle9i数据库如何备份? 关于oracle9i中作业执行的2个疑问,请高手指点。 ORACLE补丁问题? 刚装了oracle,请问如何使用他自带的帮助文档呀? 帮忙?ms Sql server 与oracal有什么区别呢?望帮吗 求助:如何彻底删除oracle???
如果isactive的值=0,返回:'是'
如果isactive的值=1,返回:'否'
其它值,返回:'其它'sign(n) 如果n>0 return 1,n<0 return -1,n=0 return 0.
第二个 第一个用来比较的值其实相当于这样一个
if(inactive =0) then sign='是'
else if(inactive=1) then sign= '否'
else='其它'
sign是命名最后结果的字段名
上面的语句中 sign是我随便写的一个 列的别名。
select title,input_date,author,isactive from (select title,input_date,author,decode(isactive,0,'是',1,'否') as isactive from impnote)