From: | Holger Klawitter <holger(at)klawitter(dot)de> |
---|---|
To: | Ryan Mahoney <ryan(at)paymentalliance(dot)net>, "pgsql-general(at)postgreSQL(dot)org" <pgsql-general(at)postgreSQL(dot)org> |
Subject: | Re: query varchar fields by length |
Date: | 2001-04-19 14:03:30 |
Message-ID: | 3ADEF032.80DA7868@klawitter.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Ryan Mahoney wrote:
>
> Is it possible to select rows from a field based on the length of the data
> in a varchar field?
length works fine in a select on a varchar field.
select a from b where length(a)=5;
You didn't ask for this, did you?
Grabbing different columns depending on values of another another column
can be done with "case":
select
case
when length(col_var)<5 then col_a
when length(col_var)>5 then col_b
else col_5
end
from
tbl
;
With kind regards / Mit freundlichem Gruß
Holger Klawitter
--
Holger Klawitter
holger(at)klawitter(dot)de http://www.klawitter.de
From | Date | Subject | |
---|---|---|---|
Next Message | Martín Marqués | 2001-04-19 14:26:29 | Re: Authentication Question |
Previous Message | Tatsuo Ishii | 2001-04-19 13:56:00 | Re: Postgres and Unicode |