Re: Help with simple SQL query? - Mailing list pgsql-sql

From Joost Kraaijeveld
Subject Re: Help with simple SQL query?
Date
Msg-id 1128518380.3655.226.camel@Panoramix
Whole thread Raw
In response to Re: Help with simple SQL query?  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
List 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 by date:

Previous
From: Frank van Vugt
Date:
Subject: Re: Help with simple SQL query?
Next
From: Andreas Kretschmer
Date:
Subject: Re: BirthDay SQL Issue