Re: Aggregates and joined tables...

From: "omid omoomi" <oomoomi(at)hotmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Cc: tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-sql(at)postgresql(dot)org
Subject: Re: Aggregates and joined tables...
Date: 2001-02-08 13:42:50
Message-ID: F28fN3vSAMfKQu1bCdU000016eb@hotmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-sql

Hello,
I have upgraded my DB to 7.0.3, but there is still the problem. I think that
it may be a bug.
Joining 3 tables was not possible...
It says "fa1 should be in aggregate too" !

While joining 2 tables gives wrong results ...
ie, if the results should be like this:
fa1 sum
----- -------
ali 100
omid 200
shaya 50

then I get this:
fa1 sum
----- -------
ali 350
omid 350
shaya 350

Any more idea ?
Omid Omoomi

>>The platform is PostgreSQL 6.5.2 on i386-unknown-freebsd3.2, compiled by
>>gcc 2.7.2.1 .

>>The story is that I need to join two tables with an aggregate function.
>>Here is a sample model :

>>Table A consist of ( fa1 , fa2 )
>>Table B consist of ( fb1 , fb2 )
>>Table C consist of ( fc1 , fc2 ,fc3 )

>>I want to write a query which looks like this :
>>select fa1 - sum(fc3)
>>from A,B,C
>>where fa1=fb1 and fb2=fc2
>>group by fa1 ;
>>unfortunately I get this in result:
>>ERROR: Illegal use of aggregates or non-group column in target list

>Works fine in current sources. Try upgrading to something newer than
6.5.2 ...

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Browse pgsql-general by date

  From Date Subject
Next Message Stefan Waidele jun. 2001-02-08 13:52:23 Re: numeric type and odbc from access 2000
Previous Message Jan Wieck 2001-02-08 11:52:24 Re: Cursors in SPI functions/procedures

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2001-02-08 15:03:55 Re: [SQL] Re: PL/pgsql EXECUTE 'SELECT INTO ...'
Previous Message Michael Ansley 2001-02-08 13:35:14 RE: [SQL] Re: PL/pgsql EXECUTE 'SELECT INTO ...'