| От | Ed Loehr |
|---|---|
| Тема | Re: A subselect in an aggregate |
| Дата | |
| Msg-id | 39578B61.CDAF7D91@austin.rr.com обсуждение исходный текст |
| Ответ на | A subselect in an aggregate ("Bryan White" <bryan@arcamax.com>) |
| Список | pgsql-sql |
Bryan White wrote: > > This statement works: > select date, (select sum(qty * price) from orderdetail d where d.orderid = > orders.orderid) from orders > > But when I try to do something like this: > > select date, sum(select sum(qty * price) from orderdetail d where d.orderid > = orders.orderid) from orders group by date > > I get ERROR: parser: parse error at or near "select" > > Is there a way to apply an agregate function to a subselect like this? Avoiding the question, I'm wondering if this simpler form wouldn't be what you're after? select o.date, sum(d.qty * d.price) from orderdetail d, orders owhere d.orderid = o.orderidgroup by o.date Regards, Ed Loehr
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера