简体   繁体   English

将ANYELEMENT与实体SQL一起使用的子查询

[英]Subquery using ANYELEMENT with Entity SQL

According to the Microsoft Documents ( http://msdn.microsoft.com/en-us/library/bb738573.aspx ) for Entity SQL in order to return a scalar subquery I need to use the function ANYELEMENT(). 根据用于Entity SQL的Microsoft文档( http://msdn.microsoft.com/zh-cn/library/bb738573.aspx ),为了返回标量子查询,我需要使用函数ANYELEMENT()。

However, when I try that I am getting this as my returned values: 但是,当我尝试将其作为返回值时:

System.Data.Query.ResultAssembly.BridgeDataRecord System.Data.Query.ResultAssembly.BridgeDataRecord

My query: 我的查询:

SELECT

ANYELEMENT(
SELECT SUM(CASE WHEN B.EXECUTION_STATUS_ID=2 THEN 1 ELSE 0 END)
    FROM SpiraTestEntities.R_TestCases AS B
    WHERE TruncateTime(B.EXECUTION_DATE) <= DateExecuted) AS PASSED,

DateExecuted


FROM SpiraTestEntities.R_TestCases as A

where A.PROJECT_ID = ${ProjectId}

AND A.IS_DELETED = false

AND A.EXECUTION_DATE IS NOT NULL

GROUP BY 

TruncateTime(A.EXECUTION_DATE) as DateExecuted

I should be getting something more like this: 我应该得到更多这样的东西:

PASSED      DateExecuted
------      ------------
   37       2014-06-05
   67       2014-06-06
   92       2014-06-09

But I'm getting this: 但是我得到这个:

PASSED                                                      DateExecuted
------                                                      ------------
System.Data.Query.ResultAssembly.BridgeDataRecord            2014-06-05
System.Data.Query.ResultAssembly.BridgeDataRecord            2014-06-06
System.Data.Query.ResultAssembly.BridgeDataRecord            2014-06-09

Any ideas? 有任何想法吗?

SELECT之后添加VALUE

ANYELEMENT(SELECT VALUE SUM(CASE WHEN ...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM