根据ID合并两行 [英] concatrnating two rows based on a Id

查看:134
本文介绍了根据ID合并两行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有带有选择,选择ID和问题ID之类的字段的表.

现在,我想将与一个问题相关的选择合并到一个语句中,然后插入第二个表中.

对于前

choiceId choiceName问题ID
1个1
2 b 2


questionId选择
1〜1〜2〜
我该怎么办?

I have table with fields like choices ,choice Id and question Id.

Now i want to join this choices which are associated to a question into a single statement and insert into the second table.

for ex

choiceId choiceName questionId
1 a 1
2 b 2


questionId choices
1 ~1~2~
How can i do it ?

推荐答案

请通过此链接
http://sqlyoga.com/2009/02/sql-server-get- comma-separated-list.html
Please go through this link
http://sqlyoga.com/2009/02/sql-server-get-comma-separated-list.html


这篇关于根据ID合并两行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆