a question on SQL

Поиск
Список
Период
Сортировка
От Tomi N/A
Тема a question on SQL
Дата
Msg-id d487eb8e0612120847o5b578122t98ce838cc7ee3690@mail.gmail.com
обсуждение исходный текст
Ответы Re: a question on SQL  (Ragnar <gnari@hive.is>)
Список pgsql-general
Don't really know where to ask this...the general mailing list sounds
like the closest.

Let's say I have three tables: owner, factory and product with a 1:N
relationship at each step.
Assuming that a product has a production date, how would you go about
returning a factory for every owner, where the returned factory is the
factory that produced the oldest product of it's owner?

I'm perplexed by the simplicity of the task and the fact that what
solutions I did come up with fail to perform very well (a subselect
with ORDER BY MIN(production_date) LIMIT 1) or are rather complex
(using temp tables).

Hints?

TIA,
t.n.a.

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

Предыдущее
От: Erik Jones
Дата:
Сообщение: Re: date comparisons
Следующее
От: Brad Nicholson
Дата:
Сообщение: Re: Unrecognized time zone name error.