Quantcast
Channel: Quality Center / ALM Practitioners Forum topics
Viewing all articles
Browse latest Browse all 5491

Query on AUDIT_LOG not returning latest change using MAX()

$
0
0

I am trying to create an ageing report for bugs in Released to Retest status using below query. Issue is that even though I am using MAX(), I get multiple rows for some defects (Defects that have moved to RTR status more than once). Please see the attached sample data the query is returning and suggest a solution to retrieve just the latest record.

 

SELECT
BUG.BG_RESPONSIBLE as "Assigned to",
bug.bg_severity as "Severity",
AUDIT_LOG.AU_ENTITY_ID AS "Defect ID",
TO_CHAR (MAX(AUDIT_LOG.AU_TIME), 'DD-MON-YYYY HH:MM') AS "Moved to RTR On",
AUDIT_LOG.AU_USER AS "Moved to RTR By",
Round(SYSDATE-AUDIT_LOG.AU_TIME,0) AS "RTR AGE (Days)"

FROM
AUDIT_LOG INNER JOIN AUDIT_PROPERTIES ON AUDIT_LOG.AU_ACTION_ID = AUDIT_PROPERTIES.AP_ACTION_ID
inner join bug on au_entity_id = cast(bg_bug_id as varchar(200))
WHERE

AUDIT_LOG.AU_ENTITY_TYPE = 'BUG'
AND AUDIT_LOG.AU_ACTION = 'UPDATE'
AND AUDIT_PROPERTIES.AP_TABLE_NAME = 'BUG'
AND AUDIT_PROPERTIES.AP_FIELD_NAME = 'BG_STATUS'
AND AUDIT_PROPERTIES.AP_NEW_VALUE = 'Released to Retest'
and bug.bg_status =  'Released to Retest'
and bug.bg_detected_in_rcyc = 1003
GROUP BY BUG.BG_RESPONSIBLE, bug.bg_severity, AUDIT_LOG.AU_ENTITY_ID, AUDIT_LOG.AU_TIME, AUDIT_LOG.AU_USER
Order By BUG.BG_RESPONSIBLE, bug.bg_severity, AUDIT_LOG.AU_ENTITY_ID, AUDIT_LOG.AU_TIME, AUDIT_LOG.AU_USER


 


Viewing all articles
Browse latest Browse all 5491

Trending Articles