Awsl_BKL 2022-01-25 11:52 采纳率: 100%
浏览 48
已结题

sql 多行合并为一行

我想要将多行合并一行
select a.outpatient_code, b.value from PT_OUTPATIENT_CURE a,RCD_out_RECORD_ITEM b
where a.id=b.outpatient_id
and a.outpatient_code='685593'
and b.element_id='204032'

img

有办法吗

  • 写回答

1条回答 默认 最新

  • DarkAthena ORACLE应用及数据库设计方案咨询师 2022-01-25 13:26
    关注
    select a.outpatient_code, listagg(b.value) within group (order by b.value) 
    from PT_OUTPATIENT_CURE a,RCD_out_RECORD_ITEM b
    where a.id=b.outpatient_id
    and a.outpatient_code='685593'
    and b.element_id='204032'
    group by a.outpatient_code
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

问题事件

  • 系统已结题 2月2日
  • 已采纳回答 1月25日
  • 创建了问题 1月25日