SQL中如何将具有相同ID的多条记录按序号从大到小组合成一条记录

例如:表Aidrowidcombinationname11nulla21nullb31nullc12nulla22nullb要求根据id,rowid,name更新comb... 例如:表A
id rowid combination name
1 1 null a
2 1 null b
3 1 null c
1 2 null a
2 2 null b
要求根据id,rowid,name更新combination :
id rowid combination name
1 1 a,b,c a
2 1 a,b,c b
3 1 a,b,c c
1 2 a,b a
2 2 a,b b
展开
 我来答
匿名_热心网友
2011-10-29 · TA获得超过719个赞
知道大有可为答主
回答量:3827
采纳率:0%
帮助的人:8308万
展开全部
由于客户服务器上的数据库统一变更为sql server 2008(原来为sql server 2005),导致项目数据库无法连接。贴上数据连接配置文件(jdbc.properties)代码:
database.driverClass=com.microsoft.sqlserver.jdbc.SQLServerDriver
database.jdbcUrl=jdbc:sqlserver://192.168.7.159:1433;databaseName=HDW
database.user=sa
database.password=sa
hibernate.dialect=org.hibernate.dialect.SQLServerDialect
数据库为2005时连接是正常的,改为2008后无法连接,报错:
Connections could not be acquired from the underlying database!
架包用的是:sqljdbc4.jar
huangshuan1
2011-10-13 · TA获得超过391个赞
知道小有建树答主
回答量:749
采纳率:0%
帮助的人:356万
展开全部
所有数据都在同一个表中?然后查询到的是很多行要变成一列?
请说具体一些
更多追问追答
追问
例如:表A
id rowid combination name
1 1 null a
2 1 null b
3 1 null c
1 2 null a
2 2 null b
要求:
id rowid combination name
3 1 a,b,c c
1 1 a,b,c a
2 1 a,b,c b
1 2 a,b a
2 2 a,b b
追答
select A.id,A.rowid,B.C,A.name from A,(select A.name C,A.rowid form A group  by A.rowid) B
where A.rowid = B.rowid order by A.id group by A.rowid
这个试试吧 现在没有数据库 无法测试是否可行
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式