On May 4, 9:27 am, DaNieL <daniele.pigned...@gmail.com> wrote:
> Sorry, i know that this maybe is a basically problem, but i come from
> mysql.. and in mysql that query works...

if there's only one name per order, just put a min or max around the
second col.  as you know by now, all columns that are not GROUPed BY
must be in an aggregate function.

SELECT
 orders.code,
 MIN(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


-- 
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