From: | Mathieu Arnold <mat(at)mat(dot)cc> |
---|---|
To: | Stephan Szabo <sszabo(at)megazone23(dot)bigpanda(dot)com> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: sql subqueries problem |
Date: | 2002-08-20 15:34:10 |
Message-ID: | 104534722.1029864850@andromede.reaumur.absolight.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Lucas Brasilino | 2002-08-20 16:36:33 | Problem with timestamp field/time function.. (upgrading from 7.0 to 7.2.1) |
Previous Message | Tom Lane | 2002-08-20 14:53:45 | Re: bulk imports with sequence |