知识日志2

知识提纲:

ORACLE合并列语法

wmsys.wm_concat(EmployeeName) --->wmsys.wm_concat()的使用(ORACLE语法)

select PASSWORD,to_char(wmsys.wm_concat(EmployeeName)) as aaa
from "000".tbEmployee where EmployeeCode in ('0000','0053482') group by PASSWORD;

初始数据:

password   EmployeeName

123           陈伟1

123           陈伟2

执行上述SQL:

Password   aaa

123           陈伟1,陈伟2

 

SQL 语法中对应的函数是:Stuff

SELECT id, 
                      value = stuff
                          ((SELECT     ',' + value
                              FROM         tb AS t
                              WHERE     t .id = tb.id FOR xml path('')), 1, 1, '')
FROM         tb
GROUP BY id

 

posted @ 2015-06-17 17:22  笨笨船博  阅读(189)  评论(0编辑  收藏  举报