Re: [SQL] Problem with phone list.

2007-08-16 Thread Fernando Hevia
--- Michael Glaesemann wrote: > SELECT DISTINCT ON (phone_number) > phone_number, call_duration, id > FROM calls > ORDER BY phone_number > , call_duration DESC; Wasn't acquainted with "DISTINCT ON (column)". I found it to be many times faster than other suggestions using JOIN. Cheers,

Re: [SQL] Problem with phone list.

2007-08-15 Thread Mike Diehl
e Agosto de 2007 17:28 > Para: SQL Postgresql List > Asunto: [SQL] Problem with phone list. > > Hi all. > > I've qot a problem I need to solve. I'm sure it's pretty simple; I just > can't > seem to get it, so here goes... > > I've got a table,

Re: [SQL] Problem with phone list.

2007-08-15 Thread Michael Glaesemann
On Aug 15, 2007, at 15:28 , Mike Diehl wrote: I've got a table, actually a view that joins 3 tables, that contains a phone number, a unique id, and a call duration. The phone number has duplicates in it but the unique id is unique. I need to get a list of distinct phone numbers and the co

Re: [SQL] Problem with phone list.

2007-08-15 Thread Richard Broersma Jr
--- Mike Diehl <[EMAIL PROTECTED]> wrote: > I've qot a problem I need to solve. I'm sure it's pretty simple; I just > can't > seem to get it, so here goes... > > I've got a table, actually a view that joins 3 tables, that contains a phone > number, a unique id, and a call duration. > > The

Re: [SQL] Problem with phone list.

2007-08-15 Thread Fernando Hevia
:[EMAIL PROTECTED] En nombre de Mike Diehl Enviado el: Miércoles, 15 de Agosto de 2007 17:28 Para: SQL Postgresql List Asunto: [SQL] Problem with phone list. Hi all. I've qot a problem I need to solve. I'm sure it's pretty simple; I just can't seem to get it, so here goes.

Re: [SQL] Problem with phone list.

2007-08-15 Thread Rodrigo De León
On 8/15/07, Mike Diehl <[EMAIL PROTECTED]> wrote: > Any hints would be much appreciated. DDL + sample data, please... ---(end of broadcast)--- TIP 4: Have you searched our list archives? http://archives.postgresql.org

[SQL] Problem with phone list.

2007-08-15 Thread Mike Diehl
Hi all. I've qot a problem I need to solve. I'm sure it's pretty simple; I just can't seem to get it, so here goes... I've got a table, actually a view that joins 3 tables, that contains a phone number, a unique id, and a call duration. The phone number has duplicates in it but the unique id