Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Help!!! - Select the Max of a Distinct Set
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