我还在学习SQL。我有下表DeviceType
|shopName|Device
---------|-----------
|Shop1 |app1
|Shop1 |app2
|Shop1 |sam1
|Shop2 |app67
|Shop3 |app82
|Shop3 |sam028
我想获得以下结果
Shop1|app1|app2|sam1
Shop2|app67
Shop3|app82|sam028
我的代码如下:
select Shopname,(SELECT device FROM DeviceType where left(SNTxReference,3)='app' )
from DeviceType
但我得到Subquery返回的值超过1