select to_char(wmsys.wm_concat(patname)) as WaitPatientName from (SELECT * FROM (SELECT ROW_NUMBER() OVER(PARTITION BY cc.queuename ORDER BY cc.enroldate) rn, cc.* FROM (select * from (select a.patname,a.queuesign,a.queuename,a.enroldate,a.status from qs_register a where a.status='已登记' group by a.patname,a.queuesign,a.queuename,a.enroldate,a.status order by a.queuename,a.enroldate,a.status) bb)cc ) WHERE rn in(1,2,3) ) temp group by queuename
合并前效果:
合并后效果:
博客内容主要用于日常学习记录,内容比较随意,如有问题,还需谅解!!!