simple query question

Поиск
Список
Период
Сортировка
От Akbar
Тема simple query question
Дата
Msg-id 1107779000.20356.0.camel@tux.akbarhome
обсуждение исходный текст
Ответы Re: simple query question  (Michael Fuhr <mike@fuhr.org>)
Re: simple query question  ("John K. Herreshoff" <jkherr@power-net.net>)
Список pgsql-novice
Hi.....

Imagine I have view named view_stok_table_total....
SELECT * FROM view_stok_table_total;
index  name    sum buying_price     sale_price
1      mentos    5     100            120
2      mentos    8     110            140
3      durex     9     200            210
4      queen    10     400            450

You see, there are two mentos ( same product but different
price )......
What query command that I have to issue so that I get the list
like this:
name    sum     buying_price     sale_price
mentos   13              110            140
durex     9              200            210
queen    10              400            450

so this time, there is only one mentos. This mentos has 13 ( 8 + 5 )
stuff, and use the highest index's ( that is 2 because 2 is higher than
1 ) buying_price and sale_price value.

Thank you....

regards,

akbar


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Function to blame?
Следующее
От: Michael Fuhr
Дата:
Сообщение: Re: simple query question