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

Home -> Community -> Usenet -> c.d.o.misc -> Re: Help!!! - Select the Max of a Distinct Set

Re: Help!!! - Select the Max of a Distinct Set

From: J.P. <jp_boileau_at_yahoo.com>
Date: 26 Apr 2002 04:56:14 -0700
Message-ID: <7e388bc3.0204260356.82335be@posting.google.com>


You don't need a sub or sup query.

Here's the solution:

SELECT
   Group,
   OS,
   ASIC,
   MAX(Date)
FROM
   sometable
GROUP BY
   Group, OS, ASIC

This won't really work because both Group and Date are reserved keywords, but with proper replacements, it'll work fine.

If you need additional columns to be returned, you will also need to GROUP them.

JP

Daniel Morgan <damorgan_at_exesolutions.com> wrote in message news:<3CC8909D.62FC400_at_exesolutions.com>...
> Use group by, not distinct. Likely you will need a superquery or subquery
> to get the max date.
>
> Daniel Morgan
>
>
> Lucas Tam wrote:
>
> > Hi all... I'm having some trouble with a query I need to write.
> >
> > I have a table with the following columns:
> >
> > ID Date Group O/S ASIC Misc Columns
> >
> > I need to select the Latest Distinct Records based on Group + OS + ASIC
> > based on date.
> >
> > How do I do this?
> >
> > Thanks.
Received on Fri Apr 26 2002 - 06:56:14 CDT

Original text of this message

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