Re: problem with subselect

From: Mathieu Arnold <mat(at)mat(dot)cc>
To: Christoph Haller <ch(at)rodos(dot)fzk(dot)de>, pgsql-sql(at)postgresql(dot)org
Subject: Re: problem with subselect
Date: 2003-03-07 13:29:19
Message-ID: 2065359439.1047047359@andromede.reaumur.absolight.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

--En cette belle journée de vendredi 7 mars 2003 14:15 +0100,
-- Christoph Haller <ch(at)rodos(dot)fzk(dot)de> écrivait :
|>
|> I have this :
|>
|> SELECT date_trunc('month', f.date_creation) as mois,
|> sum(f.montant_ttc / d.taux) as facture,
|> (SELECT sum(f2.montant_ttc / d2.taux) as facture2
|> FROM facture AS f2 JOIN devise AS d2 USING (id_devise)
|> WHERE date_trunc('month', f2.date_creation)
|> <= date_trunc('month', f.date_creation))
|> FROM facture AS f JOIN devise AS d USING (id_devise)
|> GROUP BY date_trunc('month', f.date_creation)
|>
|> which does not work... telling me that
|>
|> "Sub-SELECT uses un-GROUPed attribute f.date_creation from outer
| query"
|> Which is not really true, but some way is...
|>
|> What I want is to get the sum of the month, and the sum of the month
| and
|> the previous.
|>
|> If someone has a clue, something, anything... :)
|>
| Try
| ... GROUP BY mois ;

Already tried, not working either.

--
Mathieu Arnold

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Christoph Haller 2003-03-07 14:51:15 Re: problem with subselect
Previous Message Christoph Haller 2003-03-07 13:15:32 Re: problem with subselect