2009/11/20 Oliveiros C,
<oliveiros.cristina@marktest.pt>SELECT sum(played::integer), sum(stats_exists::integer)
FROM matches
WHERE origin=1 AND stats_exists AND NOT training AND match_date > '2009-08-01';
Your approach is elegant, Thom.
But if it is to do it that way then I guess
you should drop the "AND stats_exists" part of the query because
it will filter out every line with stats_exists == f, and those (occasionally) played== t won't get summed up by the SUM() function,
ain't I right ?
Best,
Oliveiros
Yes, you're right. :) To be honest I didn't really pay much attention to the content of the WHERE clause. I just tacked it on the end from one of the original selects, but I agree that it should be removed. So we'd end up with:
SELECT sum(played::integer), sum(stats_exists::integer)
FROM matches
WHERE origin=1 AND NOT training AND match_date > '2009-08-01';
Thom