select top 13 *,(select B.Quantity from Bs_Orders as A join Bs_OrdersDtl as B on(A.Code = B.Bs_OrdersCode)where
(B.Bs_ProductsCode in (s.Code))) as sun from Bs_Products as s where s.istuan = 0 and isHotSales =1 order by sun desc,SortNo
in (s.Code))) //这里出现问题了
求解答
------解决方案-------------------- 想要的结果是不是这样的啊
select top 13 s.*,B.Quantity
from Bs_Products as s
inner join Bs_OrdersDtl as B on s.Code=B.Bs_ProductsCode
inner join Bs_Orders as A as A on A.Code = B.Bs_OrdersCode
where s.istuan = 0 and isHotSales =1
order by B.Quantity desc,SortNo
select B.Quantity from Bs_Orders as A join Bs_OrdersDtl as B on(A.Code = B.Bs_OrdersCode)where (B.Bs_ProductsCode in (s.Code))) as sun
你这个子查询 B.Quantity 会查询出多个值.
与select top 13 * 每一行没法匹配