| From: | "Christopher Kings-Lynne" <chriskl(at)familyhealth(dot)com(dot)au> |
|---|---|
| To: | <pgsql-sql(at)postgresql(dot)org>, "Nick Riemondi" <nick(at)outerscape(dot)net> |
| Subject: | Re: CASE Select, referring to selected value |
| Date: | 2002-07-02 13:57:09 |
| Message-ID: | 001b01c221d0$5c91ac00$0200a8c0@SOL |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
> select case when (current_date > available) then ((end_date -
> current_date) / 30)
> when (current_date < available) then ((end_date - available) /
> 30)
> end
> from listing
> where case > 4
>
> which yields:
> ERROR: parser: parse error at or near ">"
>
> Does anyone know how I could accomplish this?
Try an alias:
select case when (current_date > available) then ((end_date -
current_date) / 30)
when (current_date < available) then ((end_date - available) /
30)
end as asdf
from listing
where asdf > 4
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nick Riemondi | 2002-07-02 14:30:19 | Re: CASE Select, referring to selected value |
| Previous Message | Chantal Ackermann | 2002-07-02 12:48:50 | Temporary table instead of repeated joins |