楼主:
licheer (Keep The Faith)
2018-11-09 01:53:28数据库名称: MS-SQL
数据库版本: VBA
内容/问题描述: 想要读右边的样子
Name Location Number Name 001 002 003
A 001 50 A 50 10 20
A 002 10 B 30 10 0
A 003 20 ==>
B 001 30
B 002 10
Select
Name,
Number=(Select i.Number From Table as i where i.Locate=001 and i.Name=j.Name),
Number=(Select i.Number From Table as i where i.Locate=002 and i.Name=j.Name),
Number=(Select i.Number From Table as i where i.Locate=004 and i.Name=j.Name)
From Table as j
上面这样写会得到错误"子查询传回不只1 个值"
请问要怎么改呢?
谢谢