From: Trinath Somanchi <trinaths@intoto.com>
To: Ashish Karalkar <ashish_postgre@yahoo.co.in>
Cc: pggeneral <pgsql-general@postgresql.org>
Subject: Re: SQL Query
Date: Thu, 13 Dec 2007 13:02:44 +0000
Message-ID: <20071213130244.090cb587@1mc110.intotoind.com> (raw)
In-Reply-To: <401674.75312.qm@web94303.mail.in2.yahoo.com>
References: <401674.75312.qm@web94303.mail.in2.yahoo.com>
Hi ,
Try this out
SELECT count(o.id)
FROM output_table o , parent_table p
WHERE o.pid=p.pid AND o_date < now()
GROUP BY p.pid ;
On Thu, 13 Dec 2007 10:00:56 +0000 (GMT)
Ashish Karalkar <ashish_postgre@yahoo.co.in> wrote:
> 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.
--
Trinath Somanchi ,
(trinaths@intoto.com),
********************************************************************************
This email message (including any attachments) is for the sole use of the intended recipient(s)
and may contain confidential, proprietary and privileged information. Any unauthorized review,
use, disclosure or distribution is prohibited. If you are not the intended recipient,
please immediately notify the sender by reply email and destroy all copies of the original message.
Thank you.
Intoto Inc.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: trinaths@intoto.com, ashish_postgre@yahoo.co.in
Subject: Re: SQL Query
In-Reply-To: <20071213130244.090cb587@1mc110.intotoind.com>
References: <401674.75312.qm@web94303.mail.in2.yahoo.com> <20071213130244.090cb587@1mc110.intotoind.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox