From: | Ennio-Sr <nasr(dot)laili(at)tin(dot)it> |
---|---|
To: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: How to obtain algebraic sum of equal lines |
Date: | 2006-04-25 21:53:38 |
Message-ID: | 20060425215338.GA13828@deby.ei.hnet |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
* Oisin Glynn <me(at)oisinglynn(dot)com> [250406, 17:24]:
> Ennio-Sr wrote:
> >Hi Oisin and Frank,
> >
> >* Frank Bax <fbax(at)sympatico(dot)ca> [250406, 16:41]:
> >
> >>At 04:12 PM 4/25/06, Ennio-Sr wrote:
> >>
> >>
> >>>Hi all,
> >>>Is it possible, given the following table:
> >>> ...
> >
> >The point is that command would return two cols only, whereas I would
> >like to have all the cols, like:
> >
> > 26 | aaa | 1500 | 6.11098 | 6.176 | 6.1110 | t | 1500
> > 28 | bbb | 2000 | 3.862 | 4.6 | 4.1957 | f | 3200
> >
> >i.e. aaa=(-1000+2500=1500), bbb=(2700+500-700-500)=2000
> >which, I fear, is not possible ;-(
> >
> >
> select *,(select sum(quantity) from test_t t2 where t2.titolo=t1.titolo)
> as sum from test_t t1;
>
> would do it though who knows how inefficient this is?
>
Well, it's better than nothing, anyway. At list I'll get the balance
quantity for each equal titolo :-)
Thank you Oisin!
Regards,
Ennio.
--
[Perche' usare Win$ozz (dico io) se ..."anche uno sciocco sa farlo. \\?//
Fa' qualche cosa di cui non sei capace!" (diceva Henry Miller) ] (°|°)
[Why use Win$ozz (I say) if ... "even a fool can do that. )=(
Do something you aren't good at!" (as Henry Miller used to say) ]
From | Date | Subject | |
---|---|---|---|
Next Message | Ennio-Sr | 2006-04-25 22:00:59 | Re: How to obtain algebraic sum of equal lines |
Previous Message | Frank Bax | 2006-04-25 21:25:02 | Re: How to obtain algebraic sum of equal lines |