| From: | Marcin Grondecki <ojciec(at)mtl(dot)pl> |
|---|---|
| To: | pete collins <pcollins(at)ocsny(dot)com> |
| Cc: | pgsql-general(at)postgreSQL(dot)org |
| Subject: | Re: [GENERAL] trouble with sum |
| Date: | 1999-03-20 03:52:37 |
| Message-ID: | 3.0.6.32.19990319195237.007f9be0@mtl.pl |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-general |
select sum(p.price), p.product_id, s.sid from ...
where ...
group by p.product_id, s.sid
"group by" clause is the key. You cannot use non-aggregate fields
in question like this, where some fields are aggregates, without grouping
them.
Sometimes i'd like to use syntax you presented, but in postgreSQL
it isn't possible :( And it makes some sense...
At 13:29 99-03-19 -0500, you wrote:
>select sum(P.price), P.product_id, S.sid, S.product_id from products P,
>shoppers S
>where S.sid='0319199910043810.3.0.12' and P.product_id= S.product_id;
>
>i've used similar commands like this one with other engines with no
>trouble
>
>what do i need to do to get it to work with postgre
>
Marcin Grondecki
ojciec(at)mtl(dot)pl
+48(604)468725
***** I'm not a complete idiot, some parts are missing...
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marcin Grondecki | 1999-03-20 04:05:48 | Re: [GENERAL] database-level locking |
| Previous Message | Jeff Gerhart | 1999-03-19 20:16:07 | 6.5 Beta Status |