摘要:1、decode 使用decode判断字符串是否一样 DECODE(value,if1,then1,if2,then2,if3,then3,...,else) decode(条件,值1,返回值1,值2,返回值2,...值n,返回值n,缺省值) 某些场景可以代替case when 2、listagg
阅读全文
摘要:如果该列字段有为空的值,那么根据另一个字段值去判断结果,可以使用嵌套case when select p.id, p.pay_no, p.pay_status, case when nvl(p.check_result,'-1')='-1' then case when p.pay_status =
阅读全文
摘要:在开发时,如果遇到表需要加字段,那么需要对存量数据刷新这个字段值 1、mysql --两张表关联 UPDATE JC_COLL_REPAY r INNER JOIN lc_lm_loan l ON r.loan_no = l.loan_no SET r.loan_typ = l.tep_cde, r
阅读全文
摘要:方法一: -- 方法1 select a.* from table a where not exists(select 1 from table b where b.id_no=a.id_no and b.crt_time>a.crt_time) 方法二:子查询 -- 方法2 select a.*
阅读全文