Re: PGSQL-to-MYSQL Migration: Error in a 'simple' inner join query

Поиск
Список
Период
Сортировка
От Ivan Sergio Borgonovo
Тема Re: PGSQL-to-MYSQL Migration: Error in a 'simple' inner join query
Дата
Msg-id 20090504194304.3e976c61@dawn.webthatworks.it
обсуждение исходный текст
Ответ на PGSQL-to-MYSQL Migration: Error in a 'simple' inner join query  (DaNieL <daniele.pignedoli@gmail.com>)
Список pgsql-general
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


В списке pgsql-general по дате отправления:

Предыдущее
От: Bill Moran
Дата:
Сообщение: Re: PGSQL-to-MYSQL Migration: Error in a 'simple' inner join query
Следующее
От: Andy Colson
Дата:
Сообщение: Re: PGSQL-to-MYSQL Migration: Error in a 'simple' inner join query