Received: from localhost (unknown [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 6587A2E411A for ; Thu, 13 Dec 2007 06:01:09 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-maia, port 10024) with ESMTP id 62499-04 for ; Thu, 13 Dec 2007 06:01:02 -0400 (AST) Received: from n6.bullet.ukl.yahoo.com (n6.bullet.ukl.yahoo.com [217.146.182.183]) by postgresql.org (Postfix) with SMTP id 271792E379B for ; Thu, 13 Dec 2007 06:01:00 -0400 (AST) Received: from [217.12.4.214] by n6.bullet.ukl.yahoo.com with NNFMP; 13 Dec 2007 10:00:58 -0000 Received: from [68.142.230.28] by t1.bullet.ukl.yahoo.com with NNFMP; 13 Dec 2007 10:00:58 -0000 Received: from [66.196.101.130] by t1.bullet.re2.yahoo.com with NNFMP; 13 Dec 2007 10:00:58 -0000 Received: from [127.0.0.1] by rrr1.mail.re1.yahoo.com with NNFMP; 13 Dec 2007 10:00:58 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 131908.26897.bm@rrr1.mail.re1.yahoo.com Received: (qmail 75955 invoked by uid 60001); 13 Dec 2007 10:00:56 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.co.in; h=X-YMail-OSG:Received:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=QD9wSlg5JNob0Uf6BCRgFpLWfa3uDeUnHD9F4n9LjtPlXDicCtMBOm0tUfiYUJ7a+hYjRPd+kThbNJ2spTczIJbg1j1R7qgMa7GgflmpkKxWhlVVZOd/BoUKIhw8kEc3ozS9YfJwgVRuvRg07B/i4nv58XDX9udDYUOa35Lx5aA=; X-YMail-OSG: GvPGnl0VM1m7oerqrh5NtB840P608aW5JvfzlOvlHJzPP28cGljCUREpk.NIgB5bbynfG2MW34ulBGSA.0n2kRtlaj_SRhP92uX9 Received: from [59.163.11.66] by web94303.mail.in2.yahoo.com via HTTP; Thu, 13 Dec 2007 10:00:56 GMT Date: Thu, 13 Dec 2007 10:00:56 +0000 (GMT) From: Ashish Karalkar Subject: SQL Query To: pggeneral MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1832031165-1197540056=:75312" Content-Transfer-Encoding: 8bit Message-ID: <401674.75312.qm@web94303.mail.in2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200712/886 X-Sequence-Number: 125629 --0-1832031165-1197540056=:75312 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello List member, I have a table which ha sfollowing structure my_table: ( output_id serial priimary key, parent_id int, output_date timesatmp ) parent_table: (parent_id int, parent desc ) the my_table contains data for previous as well as future output dates. for single parent there may be multiple rows. I want to retrieve all the output_id which are having latest output_date but less than now() (no future output_dates) group by parent_id Thanks in advance With Regards Ashish... --------------------------------- Forgot the famous last words? Access your message archive online. Click here. --0-1832031165-1197540056=:75312 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Hello List member,
I have a table which ha sfollowing structure

my_table:
(
    output_id serial priimary key,
    parent_id int,
    output_date timesatmp
)

parent_table:

(parent_id int,
parent desc
)

the my_table contains data for previous as well as future output dates.
for single parent there may be multiple rows.

I want to retrieve all the output_id  which are having latest output_date but less than now() (no future output_dates) group by  parent_id

Thanks in advance

With Regards
Ashish...


Forgot the famous last words? Access your message archive online. Click here. --0-1832031165-1197540056=:75312--