SQL语句case whenselect trunc(date '2009-01-01','dd') as date_id, b.org_id as org_id, b.risk_id as risk_id, sum(a.planfee-nvl(c.payreffee,0)) , (case when to_char(statistic_date-payrefdate>=0) and to_char(st

来源:学生作业帮助网 编辑:作业帮 时间:2024/11/15 18:46:01

SQL语句case whenselect trunc(date '2009-01-01','dd') as date_id, b.org_id as org_id, b.risk_id as risk_id, sum(a.planfee-nvl(c.payreffee,0)) , (case when to_char(statistic_date-payrefdate>=0) and to_char(st
SQL语句case when
select    trunc(date '2009-01-01','dd') as date_id,          b.org_id as org_id,          b.risk_id as risk_id,          sum(a.planfee-nvl(c.payreffee,0)) ,          (case when to_char(statistic_date-payrefdate>=0) and to_char(statistic_date-payrefdate<90) then sum(a.planfee-nvl(c.payreffee,0))  else '' end),          (case when to_char(statistic_date-payrefdate>=90) and to_char(statistic_date-payrefdate<180) then sum(a.planfee-nvl(c.payreffee,0))  else '' end),          (case when to_char(statistic_date-payrefdate>=180) and to_char(statistic_date-payrefdate<360) then sum(a.planfee-nvl(c.payreffee,0))  else '' end),          (case when to_char(statistic_date-payrefdate>=360) and to_char(statistic_date-payrefdate<720) then sum(a.planfee-nvl(c.payreffee,0))  else '' end),          (case when to_char(statistic_date-payrefdate>=720) then sum(a.planfee-nvl(c.payreffee,0)) else '' end)          from dm_f_prpjplanfee_prop a,dm_policy_prop_cnt b,(select certino,serialno,sum(payreffee) as payreffee from dm_f_prpjpayrefrec_prop where payrefdate<=(date'2009-01-31') group by certino,serialno)  cwhere   a.certino=b.endorse_no  and a.certino=c.certino(+) and a.serialno=c.serialno(+)and     not exists (select 1                   from dm_policy_prop_cnt                  where b.policy_no = policy_no                    and endorse_type_code = '19'                    and certi_type = 'E'                    and statistic_date <= date  '2009-01-31')                    --and b.policy_no='605012008110000000741'                    and b.statistic_date <= date  '2009-01-31' group by trunc(date '2009-01-31','dd'),b.org_id,b.risk_id  这是一个SQL里面的case when语句,如果执行这个语句,会提示缺少右括号,但如果把case when语句去掉,就可以执行这个语句.

SQL语句case whenselect trunc(date '2009-01-01','dd') as date_id, b.org_id as org_id, b.risk_id as risk_id, sum(a.planfee-nvl(c.payreffee,0)) , (case when to_char(statistic_date-payrefdate>=0) and to_char(st
太长了,但是看到一个问题,case when,要求返回的类型必须一直.
你看你的第一个case when语句
(case when to_char(statistic_date-payrefdate>=0) and to_char(statistic_date-payrefdate

SQL语句case whenselect trunc(date '2009-01-01','dd') as date_id, b.org_id as org_id, b.risk_id as risk_id, sum(a.planfee-nvl(c.payreffee,0)) , (case when to_char(statistic_date-payrefdate>=0) and to_char(st sql语句 decimal(18, sql case when请教请教sql中case when 判断语句select 姓名,工龄,(case when (工龄>= '35') then 90%when (工龄>='30' and 工龄='20' and 工龄='10' and 工龄 sql语句中DISTINCT是什么意思 integer是什么意思?SQL语句中 SQL语句中的(;)分号是什么意思? SQL中begin end 怎么用着条语句? SQL 语句 SELECT * FROM {{table}} WHERE `fleet_end_time` sql语句中什么时候用commit? sql 语句中commit的作用 vb select case 这个语句? sql 语句 建好表了 赋值语句怎么写 格式初学者 DROP-SQL语句属于一种什么功能的语句 DROP-SQL语句属于一种什么功能的语句 清空某表的全部数据的SQL语句是不是这样写?SQL语句:truncate table phpcms_ads_stat SQL server中哪些语句中运用逻辑表达式?请回答除了:where ,if(else if),while,case when..then..,having,on越多越好,最好能有简单例子. sql语句 case when or 自己写的sqlselect date_format(createDate,'%Y-%m-%d') as createDate,count(case when reqtype='runUp' then imei end) as runUp,count(case when (reqtype='login' or reqtype='register') then imei end) as loginFROM (select distinct sql 中的case与group by有一张表,三个字段:语文、数学、英语.其中有三条记录分别表示语文70、数学80、英语58 请用一条sql语句查询出这三条记录并按以下条件显示出来(并写出思路) 大于等