表同一个id多个名称如何读取 [英] table same id multiple name how to read

查看:78
本文介绍了表同一个id多个名称如何读取的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有桌面顾客



一个custid有多个prdId喜欢,

 cusid prdId 
1 1
1 2
2 1
3 1
4 1
4 2
4 3



我如何用不同的prdId阅读相同的cusid



我想回答的是

 1 [1,2] 
2 [1]
3 [1]
2 [1,2,3]

解决方案

愚蠢的CTE技巧 - 字符串连接 [ ^ ]

I have table customer

one custid has more than one prdId like,

cusid   prdId
1        1
1        2
2        1
3        1
4        1
4        2
4        3


How do i read a same cusid with different prdId

I want answer is is

1 [1,2]
2 [1]
3 [1]
2 [1,2,3]

解决方案

Stupid CTE tricks -- string concatenation[^]


这篇关于表同一个id多个名称如何读取的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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