Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Subquery help with Max !

Re: Subquery help with Max !

From: April <privateBenjamin_at_hushmail.com>
Date: 26 Feb 2002 07:20:21 -0800
Message-ID: <6effef59.0202260720.6119daec@posting.google.com>


Thanks very much Guido, that worked perfectly!

April

"Guido Konsolke" <NoSpam_at_MyAccount.com> wrote in message news:<1014707155.360666_at_news.thyssen.com>...
> "April" <privateBenjamin_at_hushmail.com> wrote news:6effef59.0202251520.661b1894_at_posting.google.com...
> > I have a table like this:
> >
> > Paymentkey PaymentYear PaymentMonth
> > 1 2001 1
> > 1 2000 2
> > 1 2000 6
> > 1 2002 12
> > 2 2003 1
> > 2 2004 6
> > 3 2002 3
> >
> > I want to retrieve the lowest PaymentYear AND PaymentMonth for a
> > particular PaymentKey. For example, Paymentkey1 should return
> > PaymentYear(2000),PaymentMonth(2).
> >
> > How can I get this to work?!
> Hi April,
> have a look at this:
>
> SELECT a.year, a.month
> FROM t1 a
> WHERE key=1
> AND year=(SELECT MIN(year)
> FROM t1
> WHERE key=1)
> AND month=(select MIN(month)
> FROM t1
> WHERE key=1
> AND year=(SELECT MIN(year)
> FROM t1
> WHERE key=1));
>
> I hope, this is what you're looking for.
>
> Regards,
> Guido
Received on Tue Feb 26 2002 - 09:20:21 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US