Reputation: 63
I need to count the number of test steps in each test case.
Test_Step
Test_Case_ID
Test_Step_Number
I would like to get an answer that shows me NUMBER
of test steps for each test case (Test_Case_ID
).
I would like the column to be called "Number_Of_Steps"
So far I have this, but it not functional
Select Count(
Distinct
(STANDARD_HASH(test_case_id, Test_step_nuber))
+ STANDARD_HASH (Reverse(test_case_id), REVERSE(Test_step_nuber))
)
from test_step AS "Number_Of_Steps" ;
Upvotes: 1
Views: 184
Reputation: 167962
You need to alias the computed column (not the table) and, if you want it for each test_case_id
then, you need to use GROUP BY
:
SELECT test_case_id,
COUNT( DISTINCT test_step_number ) AS Number_of_steps
FROM test_step
GROUP BY test_case_id;
I have no idea why you are hashing and reversing the columns.
Upvotes: 1
Reputation: 32599
select Test_Case_Id, count(*) as Number_Of_Steps
from Test_Step
group by Test_Case_Id
Upvotes: 1