Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Query- Need only the lates steps

Author  Topic 

jman32
Starting Member

1 Post

Posted - 2012-01-18 : 21:13:11
This query pulls all steps executed and populates a new row for every time that a change is made or updated. This results in 1 step having multiple rows. I want only 1 row per step. The row should be the latest copy from the column STEP.ST_EXECUTION_DATE

Here is the code:

SELECT DESSTEPS.DS_TEST_ID /*Design Step.Test ID*/,DESSTEPS.DS_USER_05 /*Design Step.Team*/, TEST.TS_NAME /*Test.Test Name*/,DESSTEPS.DS_STEP_NAME /*Design Step.Step Name*/,TEST.TS_USER_02 /*Test.Owner*/,DESSTEPS.DS_USER_14 /*Design Step.Task ID*/ , STEP.ST_STEP_ORDER /*Test Step.Step Order*/ , STEP.ST_STATUS /*Test Step.Status*/ , STEP.ST_EXECUTION_DATE /*Test Step.Exec Date*/ ,STEP.ST_EXECUTION_TIME /*Test Step.Exec Time*/ , TESTCYCL.TC_TESTER_NAME /*Test Instance.Responsible Tester*/ ,TEST.TS_USER_02 /*Test.Owner*/ , STEP.ST_DESCRIPTION /*Test Step.Description*/
FROM DESSTEPS /*Design Step*/
Inner join STEP
ON DESSTEPS.DS_STEP_ORDER=STEP.ST_STEP_ORDER
Inner join TESTCYCL
ON DESSTEPS.DS_TEST_ID = TESTCYCL.TC_TEST_ID
Inner join TEST
On TEST.TS_TEST_ID = DESSTEPS.DS_TEST_ID

TS_NAME DS_STEP_NAME ST_STATUS ST_EXECUTION_DATE ST_EXECUTION_TIME
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/16/2012 19:47:48
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/17/2012 13:25:46
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/17/2012 18:45:37
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/18/2012 11:21:18
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/16/2012 19:47:48
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/17/2012 13:25:46
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/17/2012 18:45:37
STR.001 - OI-186 - Customer File outbound to SFA Step_010 Passed 1/18/2012 11:21:18
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Failed 1/16/2012 20:05:15
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Pending 1/17/2012 14:36:37
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Passed 1/17/2012 18:45:37
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Passed 1/18/2012 15:33:51
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Failed 1/16/2012 20:05:15
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Pending 1/17/2012 14:36:37
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Passed 1/17/2012 18:45:37
STR.001 - OI-186 - Customer File outbound to SFA Step_020 Passed 1/18/2012 15:33:51


I'd appreciate any help I can get.
   

- Advertisement -