Skip site navigation (1) Skip section navigation (2)

Re: LIKE IN

From: David Wheeler <david(at)kineticode(dot)com>
To: josh(at)agliodbs(dot)com
Cc: sfpug(at)postgresql(dot)org
Subject: Re: LIKE IN
Date: 2004-03-02 05:53:39
Message-ID: F4686402-6C0D-11D8-A088-000A95972D84@kineticode.com (view raw or flat)
Thread:
Lists: sfpug
On Mar 1, 2004, at 9:41 PM, Josh Berkus wrote:

> I think it would be possible to implement a "value LIKE ( 
> 'x%','y%','z%')" in
> postgreSQL but you'd have to get someone interested in hacking it.

Actually, this works:

   select 'a' ~~ ANY (SELECT 'a' UNION SELECT 'b');

It's a little ugly, though. In 7.4, you can use this:

   SELECT 'a' ~~ ANY(array['a%','b%']);

Which is slightly better. But I think I'll stick to this for now:

   SELECT * from element where name LIKE 'a%' OR name LIKE 'b%';

Regards,

David


In response to

sfpug by date

Next:From: Fred MoyerDate: 2004-03-12 11:30:20
Subject: Re: Reminder: Meeting Next Week -- RSVP Please
Previous:From: Josh BerkusDate: 2004-03-02 05:41:30
Subject: Re: LIKE IN

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group