Re: Help with simple SQL query?
От | Joost Kraaijeveld |
---|---|
Тема | Re: Help with simple SQL query? |
Дата | |
Msg-id | 1128518380.3655.226.camel@Panoramix обсуждение исходный текст |
Ответ на | Re: Help with simple SQL query? (Frank van Vugt <ftm.van.vugt@foxi.nl>) |
Список | pgsql-sql |
On Wed, 2005-10-05 at 14:21 +0200, Frank van Vugt wrote: > Hi Joost, > > Try joining and comparing the order table with/to an aggregated orderline > table, something like this: > > select order_id, order_price, sum_price, order_price - sum_price as diff > from order, (select parent_order_id, sum(orderline_price) as sum_price > from orderline group by parent_order_id) as foo > where order_id = parent_order_id > and order_price != sum_price > > > This should prove to be as efficient as it gets ;) How nice. An answer between the questions. And a working anser!. Which manual did I miss ;-) Thanks. -- Groeten, Joost Kraaijeveld Askesis B.V. Molukkenstraat 14 6524NB Nijmegen tel: 024-3888063 / 06-51855277 fax: 024-3608416 e-mail: J.Kraaijeveld@Askesis.nl web: www.askesis.nl
В списке pgsql-sql по дате отправления: