X-Original-To: pgsql-sql@postgresql.org Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 601CC474E4F for ; Mon, 24 Feb 2003 10:50:46 -0500 (EST) Received: from postgresql.org ([64.49.215.8]) by localhost (postgresql.org [64.49.215.8:10024]) (amavisd-new) with SMTP id 90400-06 for ; Mon, 24 Feb 2003 10:50:35 -0500 (EST) Received: from www.trade-india.com (ns1.trade-india.com [66.234.10.14]) by postgresql.org (Postfix) with SMTP id 6F667474E42 for ; Mon, 24 Feb 2003 10:50:35 -0500 (EST) Received: (qmail 32709 invoked by uid 99); 24 Feb 2003 15:51:37 -0000 Received: from 219.65.254.132 (SquirrelMail authenticated user mallah) by mail.trade-india.com with HTTP; Mon, 24 Feb 2003 21:21:37 +0530 (IST) Message-ID: <1037.219.65.254.132.1046101897.squirrel@mail.trade-india.com> Date: Mon, 24 Feb 2003 21:21:37 +0530 (IST) Subject: Re: Help with query involving aggregation and joining. From: To: In-Reply-To: <3E5A22EA.B1904F75@rodos.fzk.de> References: <3E5A22EA.B1904F75@rodos.fzk.de> X-Priority: 3 Importance: Normal X-MSMail-Priority: Normal Cc: , X-Mailer: SquirrelMail (version 1.2.6) MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Scanned: by amavisd-new X-Archive-Number: 200302/532 X-Sequence-Number: 11930 sorry i did not post any sample data or definations. i was replying to someone else's posting i do get such an error on pgsql 7.3.2 regds mallah. >> >> ERROR: >> SELECT DISTINCT ON expressions must match >> initial ORDER BY expressions may be gotten over by >> wrapping the first query result in a subselect. >> >> not sure though if its proper. >> regds >> mallah. >> >> test=3D# SELECT * from ( SELECT distinct on (a.id) b.id >> ,courseid,name,submission from course a join history b on >> (a.id=3Db.courseid) ) as results order by results.submission desc; >> > I'm currently working with > select version(); > version > --------------------------------------------------------------- > PostgreSQL 7.2.3 on hppa-hp-hpux10.20, compiled by GCC 2.95.2 > (1 row) > I've used your table definitions and sample data you've sent earlier and = do not receive an > error message on the above SELECT statement. Did you? > > Regards, Christoph ----------------------------------------- Get your free web based email at trade-india.com. "India's Leading B2B eMarketplace.!" http://www.trade-india.com/