On Mon, 4 May 2009 09:27:30 -0700 (PDT)
DaNieL <daniele.pignedoli@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