看我的写法有问题吗,下面的单独执行有数据,全部一起就得不到JG值

select 

sys_guid() as id,

'SEP' AS diseasetype,

qybah as pat_id,

'CM-0-1-3-1' as SUBMITNAME,

listagg(jg,',') within group(order by jg) as  pat_value,

sysdate as createtime,

''updatetime

 from

(select distinct T.qybah,

NCV2.VALUE as jg

from BA_SYJBK t

join ncis.BA_SYZDK a on a.syxh=t.syxh

join ncis.JY_NCIS_VALUE ncv2 on

 (SUBSTR(a.bzbm,1,3)=SUBSTR(ncv2.REMARK,1,3)or SUBSTR(t.zyzdbm,1,5)=SUBSTR(ncv2.REMARK,1,5))

and ncv2.diseasetype='SEP' and ncv2.submitname='CM-0-1-3-1' and T.qybah='798887' AND 'SEP'='SEP'

 )

group by qybah

其他问题 yzm302462 发布于 2024-4-28 10:27 (编辑于 2024-4-28 10:28)
1min目标场景问卷 立即参与
回答问题
悬赏:0 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共1回答
最佳回答
0
华莉星宸Lv7资深互助
发布于2024-4-28 10:29

看着没什么问题,你这是报错了?

select

 sys_guid() as id, 

 'SEP' AS diseasetype, 

 qybah as pat_id, 

 'CM-0-1-3-1' as SUBMITNAME, 

 listagg(jg, ',') within group(order by jg) as pat_value, 

 sysdate as createtime, 

 '' updatetime

  from (select distinct T.qybah,                         

                         NCV2.VALUE as jg         

           from BA_SYJBK t         

           join ncis.BA_SYZDK a

             on a.syxh = t.syxh         

           join ncis.JY_NCIS_VALUE ncv2 on

         

          (SUBSTR(a.bzbm, 1, 3) = SUBSTR(ncv2.REMARK, 1, 3) or

          SUBSTR(t.zyzdbm, 1, 5) = SUBSTR(ncv2.REMARK, 1, 5))         

       where ncv2.diseasetype = 'SEP'

       and ncv2.submitname = 'CM-0-1-3-1'

       and T.qybah = '798887'

       AND 'SEP' = 'SEP'         

         )

 group by qybah

  • yzm302462 yzm302462(提问者) 没报错,就是全部执行后,Jg为空,但是单独执行下面的语句,又有值
    2024-04-28 10:35 
  • 华莉星宸 华莉星宸 回复 yzm302462(提问者) select里面,只执行这段看看,select qybah as pat_id, listagg(jg, \',\') within group(order by jg) as pat_value from ....
    2024-04-28 10:41 
  • 2关注人数
  • 131浏览人数
  • 最后回答于:2024-4-28 10:29
    请选择关闭问题的原因
    确定 取消
    返回顶部