sqlserver里报子查询返回的值不止一个。当子查询跟随在 =、!=、<、<=、>、>= 之后,或子查询用作表达式时

SELECTp.ProductID,p.MerchantID,m.ShopName,m.Mobile,m.Address,p.ProductName,p.DESCRIBE... SELECT
p.ProductID,
p.MerchantID,
m.ShopName,
m.Mobile,
m.Address,
p.ProductName,
p.DESCRIBE,
(SELECT gb.Price FROM sys_ProductFeature gb WHERE gb.ProductID = p.ProductID) AS Price,
p.TypeID,
pi.ImgFile,
'recom' AS buyType
FROM
(SELECT * FROM sys_Product WHERE ProductID IN (SELECT DISTINCT pp.ProductID from sys_ProductPopedom pp WHERE pp.AccountType IN (SELECT a.AccountType FROM sys_Account a WHERE a.ObjectID = '201709064615'))) p
LEFT JOIN sys_ProductType pt ON pt.Product_Type_ID = p.TypeID
LEFT JOIN sys_Merchant m ON p.MerchantID = m.MerchantID
LEFT JOIN (SELECT pi2.ProductID,
(select top 1 ImgFile from sys_ProductImg pi1 where pi2.ProductID = pi1.ProductID) as ImgFile,
(select top 1 FeatureID from sys_ProductImg pi1 where pi2.ProductID = pi1.ProductID) as FeatureID
from sys_ProductImg pi2 group by ProductID) as pi on pi.ProductID = p.ProductID
WHERE
pi.FeatureID = 0
AND p.State = 1
求大神帮我看看...感谢
展开
 我来答
帐号已注销
2017-10-15 · TA获得超过1134个赞
知道小有建树答主
回答量:742
采纳率:73%
帮助的人:424万
展开全部
(SELECT gb.Price FROM sys_ProductFeature gb WHERE gb.ProductID = p.ProductID) AS Price
这里估计返回不止一条数据 加个 top 1
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式