Re: Help with simple SQL query?

Поиск
Список
Период
Сортировка
От Frank van Vugt
Тема Re: Help with simple SQL query?
Дата
Msg-id 200510051421.56840.ftm.van.vugt@foxi.nl
обсуждение исходный текст
Ответ на Re: Help with simple SQL query?  ("Gregory S. Williamson" <gsw@globexplorer.com>)
Ответы Re: Help with simple SQL query?  (Joost Kraaijeveld <J.Kraaijeveld@Askesis.nl>)
Список pgsql-sql
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_pricefrom orderline group by parent_order_id) as foo
where order_id = parent_order_idand order_price != sum_price


This should prove to be as efficient as it gets ;)


-- 
Best,




Frank.


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

Предыдущее
От: "Gregory S. Williamson"
Дата:
Сообщение: Re: Help with simple SQL query?
Следующее
От: Joost Kraaijeveld
Дата:
Сообщение: Re: Help with simple SQL query?