将列转换为一行
我想将 SQL 数据从行转换为列
这是我的数据
-------------------------------
|ITEM | DAY | No | Qty |
-------------------------------
| A |Monday | No 1 | 10 |
| A |Tuesday | No 1 | 10 |
| A |Tuesday | No 2 | 5 |
| A |Wednesday| NULL | NULL |
-------------------------------
我只想转换为一行并获得此结果
---------------------------------------------------------------------------
|ITEM | Monday1| Monday2 | Tuesday1 | Tuesday2 | Wednesday1 | Wednesday 2|
---------------------------------------------------------------------------
| A | 10 | NULL | 10 | 5 | NULL | NULL |
我如何构建结果? 我尝试使用数据透视表但仍然没有得到结果
谢谢
I want to convert SQL data from row to column
This is my data
-------------------------------
|ITEM | DAY | No | Qty |
-------------------------------
| A |Monday | No 1 | 10 |
| A |Tuesday | No 1 | 10 |
| A |Tuesday | No 2 | 5 |
| A |Wednesday| NULL | NULL |
-------------------------------
I want to convert into one rows only and get this result
---------------------------------------------------------------------------
|ITEM | Monday1| Monday2 | Tuesday1 | Tuesday2 | Wednesday1 | Wednesday 2|
---------------------------------------------------------------------------
| A | 10 | NULL | 10 | 5 | NULL | NULL |
How I can build the result?
I tried using a pivot table but still didn't get the result
Thank you
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以旋转它们
You can pivot them