Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 2 of 2 total
Thread "IS NULL" in HAVING clause?
Mon, Nov 26 2007 11:00 AMPermanent Link

"Hedley Muscroft"
Hi again,

Please can someone just tell if I'm correct in thinking that you can't use
"IS NULL" as a condition in a HAVING clause? I know you can use it on a
single field in a WHERE clause, but here's the SQL I'm working with :-

====================
select pay.id, pay.datetime, pay.amount, sum(alloc.amount) as allocated
from pay
left join alloc on (alloc.pay_id=pay.id)
group by pay.id, pay.datetime, pay.amount
having (sum(alloc.amount) < pay.amount) or (sum(alloc.amount) is null)
order by pay.datetime
====================

DBISAM throws up an error #11949 - Invalid expression "is null" found in
SELECT SQL...

If I change it to "= null" then it seems to work fine. Is this just a small
syntactical oversight in DBISAM, or do "is null" and "= null" mean something
different in a HAVING clause?

Thanks.

Mon, Nov 26 2007 5:26 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Hedley,

<< If I change it to "= null" then it seems to work fine. Is this just a
small syntactical oversight in DBISAM, or do "is null" and "= null" mean
something different in a HAVING clause? >>

It's a known bug in DBISAM that will be fixed in the next build - just use =
NULL instead as a workaround.

--
Tim Young
Elevate Software
www.elevatesoft.com

Image