"Patrick Welche" <[EMAIL PROTECTED]> writes: > Is this a bug, or don't I understand coalesce()? > > select coalesce(0,sum(b)) from test where a=2; -- 0 ! > > So when I use coalesce() with sum(), I always get the constant. I would > have expected it only in the case where sum() returns null..
Coalesce will return the first argument if it's not null. You may be thinking about the arguments in reverse order? -- Gregory Stark EnterpriseDB http://www.enterprisedb.com ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly