以下查询的sql错误 - 当EXISTS未引入子查询时,只能在选择列表中指定一个表达式。 [英] Error in sql for below query - Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.

查看:281
本文介绍了以下查询的sql错误 - 当EXISTS未引入子查询时,只能在选择列表中指定一个表达式。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

select
((select (case when sum(A.[Quantity]) is null then 0 else sum(A.[Quantity]) END) from [tablename] as A 
where ((A.[Status]=4) and (A.[Finished Date] ='2013-10-10' ))) +
(select 
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]),
sum(a.[Quantity]) from [tablename] 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_Order No] 
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.[Buy-from Vendor No_]='V 11201' and a.[Posting Date]='2013-10-10' and a.[Item Category Code] = 'STYLES'  
 and a.[Prod_ Order No_]='' and (a.[Quantity]>0)))

推荐答案

问题是<$ c $之后的选择c> + (在第一个中)返回多个字段(可能多于一行),那么你希望如何添加它们?
The problem is that the select after the + (in the first where) returns more than one fields (and maybe more than one rows) so how d oyou expect to add them?


这篇关于以下查询的sql错误 - 当EXISTS未引入子查询时,只能在选择列表中指定一个表达式。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆