Skip site navigation (1) Skip section navigation (2)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Gilbert <dgilbert(at)velocet(dot)ca>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject:
Date: 1999-09-30 13:33:09
Message-ID: 13840.938698389@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
David Gilbert <dgilbert(at)velocet(dot)ca> writes:
> select acct_id, 
>    sum(case when recd > ('now'::date - '30 days'::timespan)::date 
>             then amt else 0) as current 
>    from payable where not paid_p group by acct_id order by acct_id;
> but pgsql gives me:
> ERROR:  parser: parse error at or near ")"

The case construct has to be terminated with an "end" keyword;
"... else 0 end)" ought to work.

> Now... I also thought I might be able to contruct 
> sum(amt * <boolean>), but this also isn't allowed.  I think that we
> should make an int(boolean) function.

That's been suggested before, and I agree.

			regards, tom lane

pgsql-hackers by date

Next:From: Jelle RuttenbergDate: 1999-09-30 14:46:16
Subject: ODBC-client->Linux-server: datatype boolean not recognized?
Previous:From: Tom LaneDate: 1999-09-30 13:25:04
Subject: Re: [HACKERS] Regression tests on intel for 6.5.2

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group