Subject RE: [firebird-support] SQL conundrum - count disregarding date parameters
Author Clay Shannon
<< Anyway, you could speed up this query if you use Firebird 1.5 by using
the CASE expression

SELECT>
a.gender,
SUM(CASE WHEN a.actioncode = 1 THEN 1 ELSE 0 END) as hired,
SUM(CASE WHEN a.actioncode = 2 THEN 1 ELSE 0 END) as
interviewed_declinedoffer,
SUM(CASE WHEN a.actioncode = 3 THEN 1 ELSE 0 END) as interviewed_nooffer,
SUM(CASE WHEN a.actioncode = 4 THEN 1 ELSE 0 END) as not_interviewed,
....
FROM
hr_applicants a
WHERE
a.actiondate between ('6/26/2005') and ('7/26/2005')
GROUP BY
a.gender


Regards,
Arno Brinkman>>

Nice Brinkmanship--it works like a cha[mp,rm]!

Give me a shout the next time you're in Oconomowoc, I'll buy you a beer!

Clay Shannon,
Dimension 4 Software