Re: sql subqueries problem

Поиск
Список
Период
Сортировка
От Mathieu Arnold
Тема Re: sql subqueries problem
Дата
Msg-id 104534722.1029864850@andromede.reaumur.absolight.net
обсуждение исходный текст
Ответ на Re: sql subqueries problem  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-sql
>> I've tried, but, as the subselect is an aggregate, I can't get it (maybe
>> I don't know enough about it to do it :)
> 
> Right, that'd make it harder. :)
> 
> Hmm, would something like:
> 
> FROM
> (select *,
>   (select sum(ff.montant_ttc/df.taux) from facture ff join
>     devise as df using (id_devise) where ff.date_creation <=
>      f.date_creation and ff.id_client=f.id_client
>      group by ff.id_client) as facture,
>   (select sum(rr.montant/dr.taux) from remise as rr join
>     devise as dr using (id_devise) where rr.date_paiement <=
>      f.date_creation and rr.id_client=f.id_client
>      group by rr.id_client) as remise
>  From facture f
> );
> 
> give you something closer to what you want?

that's exactly it, I guess that I was not twisted enough for that one :)

-- 
Mathieu Arnold


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: bulk imports with sequence
Следующее
От: Lucas Brasilino
Дата:
Сообщение: Problem with timestamp field/time function.. (upgrading from 7.0 to 7.2.1)