need assistance with multi-row matching expression

Поиск
Список
Период
Сортировка
От Mark Stosberg
Тема need assistance with multi-row matching expression
Дата
Msg-id Pine.BSF.4.44.0208191013320.75440-100000@nollie.summersault.com
обсуждение исходный текст
Ответы Re: need assistance with multi-row matching expression  ("Nick Fankhauser" <nickf@ontko.com>)
Список pgsql-sql
Hello,

I'm using Postgres 7.1 and have been enjoying the upgraded "sub-select"
support in this release versus older versions.

At the moment, I'm stuck with a SQL issue that I haven't run into
before.

I need to select the data for all the "parks" that match some search
criteria. The parks are stored in a "parks" table with a park_id as a
primary key.

Part of the search includes the logic of "match parks that include all
these features". The "features" are stored in their own table, and are
related to the parks table with a park_feature_map table, which contains
a park_id column and a feature_id column.

A user can use 0 to N to features, and each park might have 0 to N
entries in the park_feature_map table.

Where I'm stuck is that I'm used to putting together SQL statements to
match a given row. This is different-- to create a successful match for
a park_id, I need to check to match against N rows, where N is the
number of feature_ids provided.

How do I do that? Can I do it in one query?

Thanks!
 -mark

http://mark.stosberg.com/



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

Предыдущее
От: "Christopher Kings-Lynne"
Дата:
Сообщение: Re: recursive function returning "setof"
Следующее
От: Fritz Lehmann-Grube
Дата:
Сообщение: Re: recursive function returning "setof"