Skip Navigation LinksHome Page > Forums > SpiraTeam Forums > SpiraTeam Issues & Qu... > DB Query in Spira Spits o...
Hello,
My company would like me to create a sum of the test steps that have passed, failed, blocked, etc. instead of test cases.
I tried to do my own SQL query - and it works when I access the database by the SQLCMD utility, but not in the Spira query under the custom reports.
Here it is - maybe someone will know what's going on?
SELECT
SUM(CASE WHEN execution_status_id=2 then 1 else 0 end) as Pass
FROM TST_TEST_STEP (<----From SQLCMD Utility - when I do it from the query I replace TST_TEST_STEP with SpiraEntities.R_TestSteps)
It is creating a sum correctly in the back door, but when I try and execute this in Spira I get ther error:
execution_status_id could not be resolved in current scope or context.
Any help would be appreciated.
Thanks,
Erin
Seems to work when I make the table as R.
This finally generated correctly:
SUM(CASE WHEN R.EXECUTION_STATUS_ID=2 THEN 1 ELSE 0 END) AS PASSED,
SUM(CASE WHEN R.EXECUTION_STATUS_ID=1 THEN 1 ELSE 0 END) as FAILED,
SUM(CASE WHEN R.EXECUTION_STATUS_ID=6 THEN 1 ELSE 0 END) as CAUTION,
SUM(CASE WHEN R.EXECUTION_STATUS_ID=5 THEN 1 ELSE 0 END) as BLOCKED,
SUM(CASE WHEN R.EXECUTION_STATUS_ID=3 THEN 1 ELSE 0 END) as NOTRUN
from SpiraTestEntities.R_TestSteps as R
where R.PROJECT_ID = ${ProjectId}
Thank you!
And if you have any questions, please email or call us at +1 (202) 558-6885