Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

finding this error when running the below query - Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

$
0
0
select 
min(h.[Spcl Order]),
(select (case when sum(pro.[Quantity]) is null then 0 else sum(pro.[Quantity]) END))
+
(select (case when sum(A.[Quantity]) is null then 0 else sum(A.[Quantity]) END),
min(b.[Posting Date]),min(c.[Order No]),min(d.[Prod_Order No]),min(e.[No]),
min(f.[Item Category Code]),min(g.[Location Code]),min(i.[Spcl Order_Purch])
from [tablename2] A 
inner join [sample].[dbo].[Posting Date_PRL] as b on a.[Posting Date]=b.[Posting Date]
inner join [sample].[dbo].[Order No_PRL] as c on a.[Order No_]=c.[Order No]
inner join [sample].[dbo].[Prod_ OrderNo_PRL] as d on a.[Prod_ Order No_]=d.[Prod_OrderNo] 
inner join [sample].[dbo].[No_PRL] as e on a.[No_]=e.[No]
inner join [sample].[dbo].[Item Category Code_PRL] as f on a.[Item Category Code]=f.[Item Category Code]
inner join [sample].[dbo].[Location Code_PRL] as g on a.[Location Code]=g.[Location Code]
inner join [sample].[dbo].[Spcl Order_PRL] as i on a.[Spcl Order]=i.[Spcl Order_Purch]
where ((A.[Item Category Code] = 'STYLES') and (A.[Prod_ Order No_]='') and ( A.[Buy-from Vendor No_] in ('S02052')) AND (A.[Quantity]>0) 
AND ( A.[Posting Date] = pro.[Finished Date])))

from [tablename1] pro 
inner join [sample].[dbo].[Spcl Order_PO] as h on Pro.[Spcl Order]=h.[Spcl Order]
where ((pro.[Status]=4) and (pro.[Finished Date] ='2013-10-10' )) group by pro.[Finished Date]

Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>