Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id E7F529F979D for ; Wed, 15 Aug 2007 17:44:23 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 73599-09 for ; Wed, 15 Aug 2007 17:44:20 -0300 (ADT) X-Greylist: delayed 00:09:18.304215 by SQLgrey-1.7.5 Received: from sentry.sandia.gov (mm04snlnto.sandia.gov [132.175.109.21]) by postgresql.org (Postfix) with ESMTP id D35C59F9700 for ; Wed, 15 Aug 2007 17:44:20 -0300 (ADT) Received: from [134.253.164.156] by sentry.sandia.gov with ESMTP (SMTP Relay 01 (Email Firewall v6.3.1)); Wed, 15 Aug 2007 14:34:51 -0600 X-Server-Uuid: AA8306FD-23D1-4E5B-B133-B2D9F10C3631 Received: from ef01snlnt.srn.sandia.gov ([134.253.164.107]) by ES23SNLNT.srn.sandia.gov with Microsoft SMTPSVC(6.0.3790.3959); Wed, 15 Aug 2007 14:34:51 -0600 Received: from s840908.srn.sandia.gov ([134.253.19.77]) by ef01snlnt.srn.sandia.gov with Microsoft SMTPSVC(6.0.3790.3959); Wed, 15 Aug 2007 14:34:52 -0600 From: "Mike Diehl" Organization: Sandia National Labs To: "SQL Postgresql List" Subject: Problem with phone list. Date: Wed, 15 Aug 2007 14:28:17 -0600 User-Agent: KMail/1.9.5 MIME-Version: 1.0 Message-ID: <200708151428.17740.jdiehl@sandia.gov> X-OriginalArrivalTime: 15 Aug 2007 20:34:52.0096 (UTC) FILETIME=[BB602400:01C7DF7B] X-TMWD-Spam-Summary: TS=20070815203455; SEV=2.2.2; DFV=B2007081514; IFV=2.0.4,4.0-9; AIF=B2007081514; RPD=5.02.0125; ENG=IBF; RPDID=7374723D303030312E30413031303230322E34364333363336452E303043362C73733D312C6667733D30; CAT=NONE; CON=NONE X-MMS-Spam-Filter-ID: B2007081514_5.02.0125_4.0-9 X-WSS-ID: 6ADDBCE14Q43907140-01-01 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200708/132 X-Sequence-Number: 29070 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 is unique. I need to get a list of distinct phone numbers and the coorisponding largest call duration. I've got the idea that this should be a self-join on phone number where a.id<>b.id, but I just can't seem to get the max duration. Any hints would be much appreciated. Mike.