On Mon, 4 May 2009 09:27:30 -0700 (PDT)
DaNieL <daniele.pigned...@gmail.com> wrote:

[snip]

> Every id in every table is a PRIMARY KEY, UNIQUE, NOT NULL and
> serial type..
> The query that i have problem with is:
> ---
> SELECT
>  orders.code,
>  customer.name,
>  SUM(order_item.price)
> FROM
>  orders
>  INNER JOIN customer ON (customer.id = orders.id_customer)
>  INNER JOIN order_item ON (order_item.id_order = orders.id)
> GROUP BY orders.id

> Sorry, i know that this maybe is a basically problem, but i come
> from mysql.. and in mysql that query works...

You have to add explicitly all the columns not in aggregates.
Postgresql is a bit stricter than mysql but it generally saves you a
lot of debugging later.

-- 
Ivan Sergio Borgonovo
http://www.webthatworks.it


-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to