Multiple IN

Поиск
Список
Период
Сортировка
От Leandro Fanzone
Тема Multiple IN
Дата
Msg-id 3C16298C.A6204AD1@hasar.com
обсуждение исходный текст
Ответы Re: Multiple IN  (Bruno Wolff III <bruno@[66.92.219.49]>)
Re: Multiple IN  ("Josh Berkus" <josh@agliodbs.com>)
Список pgsql-novice
Maybe this is a silly question. I have a table t with two fields f1 and
f2. Those fields together form the primary key. I want to select a list
of pairs from that table. The simplest SQL clause would be

SELECT * FROM t WHERE (f1 = v1 AND f2 = v2) OR (f1 = v3 AND f2 = v4)
...;

When that list is long, on the one hand I suppose it won't have a good
performance; on the other, the resultant clause is clumsy and too long.
Is there any other (more elegant) solution for this? If the field would
be just one, a simple IN would do better, but as far as I know there is
no IN for multiple fields.
Thank you in advance.

Leandro Fanzone


В списке pgsql-novice по дате отправления:

Предыдущее
От: "Duncan Adams (DNS)"
Дата:
Сообщение: Re: sql help
Следующее
От: Bruno Wolff III
Дата:
Сообщение: Re: Multiple IN