Doug <[EMAIL PROTECTED]> wrote:
> SELECT ProcessID, count(1), sum(BytesProcessed)
> FROM FinishedWork
> WHERE EventTime > {20 minutes ago}
> GROUP BY ProcessID, FileName
>
> Unfortunately when a file is processed twice, it's counted twice (ie
> added into the sum twice) and I need to show only unique work, so I
> need to count each processID-FileName pair only once for the given
> timeframe.

Try this:

SELECT ProcessID, 1, BytesProcessed
FROM FinishedWork
WHERE RowId IN (
    select RowId from FinishedWork
    WHERE EventTime > {20 minutes ago}
    GROUP BY ProcessID, FileName
);

Igor Tandetnik 



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to