How to use like with a list

From: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
To: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: How to use like with a list
Date: 2011-11-18 19:55:55
Message-ID: 482E80323A35A54498B8B70FF2B8798004D5F424A2@azsmsx504.amr.corp.intel.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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"

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.

Thanks in Advance !

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Gavin Flower 2011-11-18 19:56:29 Re: Is it ever necessary to vacuum a table that only gets inserts/updates?
Previous Message jonesd 2011-11-18 17:53:26 Upgrading from 8.3.14 to 8.3.16 on Windows