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

Matching a large number of user chosen

From: John Taylor <postgres(at)jtresponse(dot)co(dot)uk>
To: <pgsql-novice(at)postgresql(dot)org>
Subject: Matching a large number of user chosen
Date: 2002-04-12 09:48:41
Message-ID: 02041210484101.01886@splash.hq.jtresponse.co.uk (view raw or flat)
Thread:
Lists: pgsql-novice
Hi,

I have an application where a user can choose a large number of distinct products to process.

The SQL that I currently use looks something like this:

select * from products where date='01012000' AND ( id='123' OR id='456' OR id='789' );

There can be maybe hundreds of different unconnected id's chosen.

Is there a more elegant/efficient way to do this than a large number of ORs ?

Thanks
JohnT

Responses

pgsql-novice by date

Next:From: Rasmus MohrDate: 2002-04-12 10:48:14
Subject: Re: Matching a large number of user chosen
Previous:From: thiemoDate: 2002-04-12 05:38:55
Subject: Re: Failing tcp/ip connection

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