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
求大神帮我看看...感谢 展开
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
求大神帮我看看...感谢 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询