oracle 两行数据合并成一行_oracle10g 多行数据合并为一行 | 学步园

场景:

发布家庭作业,多个科目,但实际通知只需要一条,存储时分科目存储,发送时合并为一条发送.如

语文 背唐诗

数学 练珠算

英语 打瞌睡

发送时将合为一条记录 .

如下:

with a as

(

select course_name || description c_researcher_code,

class n_sec_code,

to_char(dateutil.int2date(end_date), 'DL') end_date,

school

from jxt_course, jxt_homework, jxt_class

where course = jxt_course.id

and jxt_class.id = class

and start_date < dateutil.Now

and end_date >= dateutil.get_day_part(dateutil.now) - 28800000

)

SELECT n_sec_code class, wmsys.wm_concat(c_researcher_code) as message

FROM a

GROUP BY n_sec_code


版权声明:本文为weixin_35867979原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。