pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Keith Gallant <keith@justhosting.ca>
To: pgsql-sql@postgresql.org
Subject: SELECT from a list
Date: Sun, 25 Jul 2004 10:18:17 -0300
Message-ID: <PDENIKIKNMLHOJKGJDLGCEPCCGAA.keith@justhosting.ca> (raw)

Hello

I am wondering if it is possible to use a SINGLE LIKE statement for a
selection from a list.

For example: If I want to return all results that a phrase starts with a
number, can I make a call similar to the following:

SELECT * FROM table WHERE phrase LIKE
{'0%','1%','2%','3%','4%','5%','6%','7%','8%','9%'};

If not is there an easier way than having to call this:

SELECT * FROM table WHERE phrase LIKE '0%' OR phrase LIKE '1%' OR phrase
LIKE '2%' OR phrase LIKE '3%' OR phrase LIKE '4%' OR phrase LIKE '5%' OR
phrase LIKE '6%' OR phrase LIKE '7%' OR phrase LIKE '8%' OR phrase LIKE
'9%';

Thank you.

Keith





view thread (5+ messages)  latest in thread

Message-ID: <PDENIKIKNMLHOJKGJDLGCEPCCGAA.keith@justhosting.ca>
Permalink:  ../PDENIKIKNMLHOJKGJDLGCEPCCGAA.keith@justhosting.ca/
Also on:    postgresql.org/message-id/PDENIKIKNMLHOJKGJDLGCEPCCGAA.keith@justhosting.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: keith@justhosting.ca
  Subject: Re: SELECT from a list
  In-Reply-To: <PDENIKIKNMLHOJKGJDLGCEPCCGAA.keith@justhosting.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox