SELECT ; UserId, ; COUNT(*) AS NumSpots, ; COUNT(DIST invoiceid) AS Invoices, ; SUM(Gross) AS TotalGross, ; SUM( IIF(Status = 'D', 1, 0)) AS Discrep, ; SUM( IIF(Status = 'R', 1, 0)) AS Reconciled ; FROM Commits ; GROUP BY 1>I need to pull invoice records from a table called 'Commits'.
>UserId - Id of the user who created the record >NumSpots - Equal to the # records retreived for the user ># Invoices - Would be the same as 'select disticnt invoiceid where userid =...' >Total Gross - SUM of the Gross column, by user >Discrep - Total number of records with Status = 'D', by user >Reconciled - Total number of records with Status = 'R', by user >