Fog Creek Software
Discussion Board

Querying resolved bugs

Hi all,

  I spent some time to build a SQL query to get all resolved bugs in the last day. Here it is:

SELECT *, TableProject.sProject AS Expr1,
    TableBug.ixStatus AS Expr2,
    TableBugEvent.dt AS Expr3
FROM dbo.BugEvent TableBugEvent INNER JOIN
    dbo.Bug TableBug ON
    TableBugEvent.ixBug = TableBug.ixBug INNER JOIN
    dbo.Status TableStatus ON
    TableBug.ixStatus = TableStatus.ixStatus INNER JOIN
    dbo.Project TableProject ON
    TableBug.ixProject = TableProject.ixProject
WHERE (TableBugEvent.ixBugEvent =
        (SELECT MAX(ixbugevent)
      FROM dbo.BugEvent
      WHERE ixbug = TableBugEvent.ixbug)) AND
    (TableProject.sProject = N'Project') AND (TableBug.ixStatus > 1) AND
    (TableBugEvent.dt > GETDATE() - 1)
ORDER BY TableBugEvent.ixBug

Maybe someone is trying to do the same, so this will help.


Alexandre B. Corrêa
Monday, July 8, 2002

*  Recent Topics

*  Fog Creek Home