From: | Randall Skelton <skelton(at)brutus(dot)uwaterloo(dot)ca> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Casting int to bool with join... |
Date: | 2004-04-02 23:21:34 |
Message-ID: | 7B5EA47C-84FC-11D8-BEF7-000393C92230@brutus.uwaterloo.ca |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Got it.
UPDATE app_id_800 SET cal_byte_w_err = (CASE WHEN
cal_byte_w_err.value=1 THEN 't'::boolean ELSE 'f'::boolean END)
FROM cal_byte_w_err
WHERE app_id_800.timestamp BETWEEN '2004-01-01 00:00:00' AND
'2004-01-01 00:00:05'
AND app_id_800.timestamp = cal_byte_w_err.timestamp;
Have a good weekend all.
Randall
On 2 Apr 2004, at 18:05, Randall Skelton wrote:
> I am trying to update rows in a new table and re-cast to boolean at
> the same time. I am absolutely certain that the integers are 0 or 1.
> Is there a one line way to do this?
>
> UPDATE app_id_800 SET cal_byte_w_err = cal_byte_w_err.value::boolean
> FROM cal_byte_w_err
> WHERE app_id_800.timestamp BETWEEN '2004-01-01 00:00:00' AND
> '2004-01-01 00:00:05'
> AND app_id_800.timestamp = cal_byte_w_err.timestamp;
>
> Many thanks... I've spent way too long trying to figure this out :(
>
> Cheers,
> Randall
From | Date | Subject | |
---|---|---|---|
Next Message | Manfred Koizar | 2004-04-03 00:40:39 | Re: [GENERAL] Large DB |
Previous Message | muteki | 2004-04-02 23:19:28 | relfilenode on 7.2.3 |