select & group by

Поиск
Список
Период
Сортировка
От Michael L. Hostbaek
Тема select & group by
Дата
Msg-id 20050404101647.GJ23648@mich2.itxmarket.com
обсуждение исходный текст
Ответы Re: select & group by  (Richard Huxton <dev@archonet.com>)
Re: select & group by  (Ragnar Hafstað <gnari@simnet.is>)
Список pgsql-sql
I've got a problem selecting some specific data from my table. Imagine
the following rows:

part    | mfg    | qty    | price    | eta    
---------------------------------------
TEST1     ABC     10     100        (No ETA, as item is in stock)
TEST1     ABC     12     120     04/04
TEST2     CBA     17     10     05/05
TEST2     CBA     10     20        (No ETA, as item is in stock)


I'd like my selection to produce the following result:

part    | mfg    | qty    | qty incoming    | highest price    | eta
-------------------------------------------------------------
TEST1     ABC     10     12         120         04/04
TEST2     CBA     10     17         20         05/05

Any clues on how to do this ? I kow the group by part, mfg, max(price) -
but I do not know how to deal with the splitting up qty and stock qty
and incoming qty.

Thanks.

/mich


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: a very big table
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: select & group by