X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 2468FD1B37C for ; Sun, 25 Jul 2004 10:56:21 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 75770-01 for ; Sun, 25 Jul 2004 13:56:26 +0000 (GMT) Received: from web11.manitu.net (web11.manitu.net [217.11.48.111]) by svr1.postgresql.org (Postfix) with ESMTP id D35A9D1B2E0 for ; Sun, 25 Jul 2004 10:56:15 -0300 (ADT) Received: from [192.168.0.1] (dsl-082-082-215-083.arcor-ip.net [82.82.215.83]) (authenticated) by web11.manitu.net (8.10.2-SOL3/8.10.2) with ESMTP id i6PDuEI08693; Sun, 25 Jul 2004 15:56:15 +0200 Subject: Re: SELECT from a list From: Markus Bertheau To: Keith Gallant Cc: pgsql-sql@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset=UTF-8 Message-Id: <1090763779.9204.1.camel@teetnang> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.4.6 (1.4.6-2) Date: Sun, 25 Jul 2004 15:56:20 +0200 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.3 tagged_above=0.0 required=5.0 tests=UPPERCASE_25_50 X-Spam-Level: X-Archive-Number: 200407/215 X-Sequence-Number: 18467 =D0=92 =D0=92=D1=81=D0=BA, 25.07.2004, =D0=B2 15:18, Keith Gallant =D0=BF= =D0=B8=D1=88=D0=B5=D1=82: > Hello >=20 > I am wondering if it is possible to use a SINGLE LIKE statement for a > selection from a list. >=20 > 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: >=20 > SELECT * FROM table WHERE phrase LIKE > {'0%','1%','2%','3%','4%','5%','6%','7%','8%','9%'}; >=20 > If not is there an easier way than having to call this: >=20 > 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%'; WHERE SUBSTRING(phrase FROM 1 FOR 1) IN ('0', '1', ....) --=20 Markus Bertheau