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

2009-05-05 Thread Jeff Davis
On Tue, 2009-05-05 at 00:10 -0700, DaNieL..! wrote: > But still i have some trouble to understand the functionality of the > orders example. > My first goal is to retrieve every order, the customer name, and the > total of the idems per order.. so (from my point of view) i *dont* > need and *dont*

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

2009-05-05 Thread Andy Colson
DaNieL..! wrote: Hi guyst.. thanks for the replies, really, them make me suppose that all what i've learned of sql from mysql can be wrong.. But still i have some trouble to understand the functionality of the orders example. My first goal is to retrieve every order, the customer name, and the t

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

2009-05-05 Thread Dennis Brakhane
On Tue, May 5, 2009 at 9:10 AM, DaNieL..! wrote: > Hi guyst.. thanks for the replies, really, them make me suppose that > all what i've learned of sql from mysql can be wrong.. Replace "all" with "much" and you pretty much got the problem with using MySQL for your first database experience. (Not

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

2009-05-05 Thread Martin Gainty
tion, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > From: daniele.pigned...@gmail.com > Subject: Re: [GENERAL] PGSQL-to-MYSQL Migration: Error in a 'simple' inner > join query > Date: Tue, 5 May 2009 00:10:56 -0700 > To: pgsql-general@postgr

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

2009-05-05 Thread Jesse
On May 4, 9:27 am, DaNieL 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

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

2009-05-05 Thread DaNieL..!
Hi guyst.. thanks for the replies, really, them make me suppose that all what i've learned of sql from mysql can be wrong.. But still i have some trouble to understand the functionality of the orders example. My first goal is to retrieve every order, the customer name, and the total of the idems p

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

2009-05-04 Thread Tom Lane
Jeff Davis writes: > Section 4.18 of SQL200n, "Functional Dependencies", shows some > interesting ways that the DBMS can make the proper inferences (I think > this is an optional feature, so I don't think PostgreSQL violates the > standard here). Just for the record, this is something that was ad

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

2009-05-04 Thread Jeff Davis
On Mon, 2009-05-04 at 12:30 -0500, Andy Colson wrote: > Yes, that query works in mysql, but only in mysql... and probably not in > any other db anywhere. It is not standard sql. My guess is that mysql > is "helping" you out by adding the customer.name for you... but maybe > not? Maybe its ret

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

2009-05-04 Thread Scott Marlowe
To get a postgresql behavior similar to mysql's you need to use distinct on: select distinct on (a) a,b,c from sometable; (or something like that) -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-

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

2009-05-04 Thread Merlin Moncure
On Mon, May 4, 2009 at 12:27 PM, DaNieL wrote: > Hi guys, this is my first approach to postgresql.. > > Well, lets say that i have 3 tables: orders, customer, and order_item. > The tables are really simple: > > --- > CREATE TABLE customer ( >    id integer NOT NULL, >    name character(50) > ); >

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

2009-05-04 Thread David Fetter
On Mon, May 04, 2009 at 09:27:30AM -0700, DaNieL wrote: > Hi guys, this is my first approach to postgresql.. > > Well, lets say that i have 3 tables: orders, customer, and order_item. > The tables are really simple: > > --- > CREATE TABLE customer ( > id integer NOT NULL, > name character

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

2009-05-04 Thread Andy Colson
DaNieL wrote: Hi guys, this is my first approach to postgresql.. Well, lets say that i have 3 tables: orders, customer, and order_item. The tables are really simple: --- CREATE TABLE customer ( id integer NOT NULL, name character(50) ); --- CREATE TABLE orders ( id integer NOT NULL,

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

2009-05-04 Thread Ivan Sergio Borgonovo
On Mon, 4 May 2009 09:27:30 -0700 (PDT) DaNieL 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

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

2009-05-04 Thread Bill Moran
In response to DaNieL : > Hi guys, this is my first approach to postgresql.. > > Well, lets say that i have 3 tables: orders, customer, and order_item. > The tables are really simple: > > --- > CREATE TABLE customer ( > id integer NOT NULL, > name character(50) > ); > --- > CREATE TABLE

[GENERAL] PGSQL-to-MYSQL Migration: Error in a 'simple' inner join query

2009-05-04 Thread DaNieL
Hi guys, this is my first approach to postgresql.. Well, lets say that i have 3 tables: orders, customer, and order_item. The tables are really simple: --- CREATE TABLE customer ( id integer NOT NULL, name character(50) ); --- CREATE TABLE orders ( id integer NOT NULL, id_customer