Re: How to use like with a list

From: John R Pierce <pierce(at)hogranch(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: How to use like with a list
Date: 2011-11-18 20:13:33
Message-ID: 4EC6BC6D.5030705@hogranch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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 'so*l%*'
>
> would match "jolly, molly, moleman,dollface, solarboy"
>
> notice they all have the same "l%' wildcarded suffix.
>
> I'm really not that lazy, just trying to keep this in a simgle query
> in order to minimize network hits which will reduce overall wallclock
> performance. This thing wil be running in a programming loop.
>
>

where field ~ '^(jo|mo|do|fo)'

--
john r pierce N 37, W 122
santa cruz ca mid-left coast

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma 2011-11-18 20:18:41 Re: How to use like with a list
Previous Message David Johnston 2011-11-18 20:12:52 Re: How to use like with a list