Subject having max() doesn't work in Firebird
Author Bill Meaney
We have a query we used in Interbase 5.6 that no longer works in Firebird
1.5.
The error indicates that Max() can no longer be used in the having clause.

Is this true?

select b.CntId, Prd.Dsc, max(a.EffDt)
from Cnt a, Cnt b, Prd, SchCtl
where a.CntEntId = b.CntEntId
and a.PrdId = b.PrdId
and b.PrdId = Prd.PrdId
and a.CntEntId = 2
and Prd.PyrId = 8
and a.CntId = SchCtl.CntId
group by b.CntId, Prd.Dsc
having b.EffDt = max(a.EffDt) <--- gives error message below
order by Prd.Dsc

Error message: Invalid expression in the HAVING clause (neither an aggregate
function nor a part of the GROUP BY clause)

I set the group by to look like this:

group by b.CntId, Prd.Dsc, max(a.EffDt

and that didn't work either.

Any suggestions?




Bill Meaney
wameaney@...
TPMS, Inc.
http://www.tpms.com