合并SQL服务器中的记录 [英] Merge record in SQL server
本文介绍了合并SQL服务器中的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下记录
参考| ID |姓名
Akash | 1 | Dan
avi | 1 | Dan
所以我需要输出像
参考| ID |名称
Akash,avi | 1 | Dan
ms sql server 2008
我尝试了什么:
i已尝试过东西和子串函数,但它不适用于我
解决方案
这是一个坏主意,你不是要将记录合并到一个列中,这会使查询变得更难并且杀死数据库引擎可以做的任何类型的优化。
I have follwing records
Reference |ID|Name
Akash |1 |Dan
avi |1 |Dan
so i need output like
Reference |ID|Name
Akash,avi |1 |Dan
In ms sql server 2008
What I have tried:
i have tried stuff and substring function but its not working for me
解决方案
This is a bad idea, you are not meant to merge records into a column like that which makes queries harder and kills any kind of optimizations the database engine can do.
这篇关于合并SQL服务器中的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文