根据 Entity SQL 的 Microsoft 文档 ( http://msdn.microsoft.com/en-us/library/bb738573.aspx ),为了返回标量子查询,我需要使用函数 ANYELEMENT()。
但是,当我尝试将其作为返回值时:
System.Data.Query.ResultAssembly.BridgeDataRecord
我的查询:
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
我应该得到更像这样的东西:
PASSED DateExecuted
------ ------------
37 2014-06-05
67 2014-06-06
92 2014-06-09
但我得到了这个:
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
有任何想法吗?