From: | "omid omoomi" <oomoomi(at)hotmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Aggregates and joined tables... |
Date: | 2001-02-04 21:42:16 |
Message-ID: | LAW-F90itmyGLttMbUs000025fa@hotmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general pgsql-sql |
Hi all,
I have a problem using aggregate function SUM() ...
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
Any idea ?
How can I have my result with only one SQL statement ?
Thanks in advance
Omid Omoomi
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Tim Barnard | 2001-02-04 21:46:09 | Re: 7.1 question |
Previous Message | Tim Barnard | 2001-02-04 20:29:03 | 7.1 question |
From | Date | Subject | |
---|---|---|---|
Next Message | Josh Berkus | 2001-02-04 23:11:23 | Directional join syntax in 7.1? |
Previous Message | Josh Berkus | 2001-02-04 20:35:19 | Re: Hrm...why is this wrong? |