Hi:
How can I search on a csv list of values using like where each value is to be
appended with a wildcarded string?
Example:
list = 'jo,mo,do,fo'
I want to pull all names from a table with name like.. 'jol%' or 'mol%'
or'dol%' or 'sol%'
would match jolly, molly, moleman,dollface, solarboy
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Gauthier, Dave
Sent: Friday, November 18, 2011 2:56 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] How to use like with a list
Hi:
How can I search on a csv list of values using like
On 11/18/11 11:55 AM, Gauthier, Dave wrote:
Hi:
How can I search on a csv list of values using like where each value
is to be appended with a wildcarded string?
Example:
list = 'jo,mo,do,fo'
I want to pull all names from a table with name like.. 'jo*l%*' or
'mo*l%*' or'do*l%*' or
On Fri, Nov 18, 2011 at 12:13 PM, John R Pierce pie...@hogranch.com wrote:
where field ~ '^(jo|mo|do|fo)'
Don't forget to add the l as the end:
where field ~ '^(jo|mo|do|fo)l'
--
Regards,
Richard Broersma Jr.
--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make
On 11/18/11 12:18 PM, Richard Broersma wrote:
On Fri, Nov 18, 2011 at 12:13 PM, John R Piercepie...@hogranch.com wrote:
where field ~ '^(jo|mo|do|fo)'
Don't forget to add the l as the end:
where field ~ '^(jo|mo|do|fo)l'
ah, yeah, that.
and to complete the original requirement...
: [GENERAL] How to use like with a list
On 11/18/11 12:18 PM, Richard Broersma wrote:
On Fri, Nov 18, 2011 at 12:13 PM, John R Piercepie...@hogranch.com wrote:
where field ~ '^(jo|mo|do|fo)'
Don't forget to add the l as the end:
where field ~ '^(jo|mo|do|fo)l'
ah, yeah, that.
and to complete
On 11/18/11 12:37 PM, Gauthier, Dave wrote:
bi_dev=# select name from test where name ~ '^(' || replace('jo,mo,do,fo', ',',
'|') || ')l';
ERROR: argument of WHERE must be type boolean, not type text
ah, needs () around the right side of the ~ expression, not sure why.
does ~ have higher
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Gauthier, Dave
Sent: Friday, November 18, 2011 3:37 PM
To: John R Pierce; PostgreSQL
Subject: Re: [GENERAL] How to use like with a list
The example was a general case
BINGO !
Thanks :-)
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of John R Pierce
Sent: Friday, November 18, 2011 3:47 PM
To: pgsql-general@postgresql.org
Subject: Re: [GENERAL] How to use like with a list
On 11/18/11