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

Home -> Community -> Usenet -> c.d.o.tools -> Re: DISTINCT and MAX

Re: DISTINCT and MAX

From: Steve Bell <swayne.bell_at_sympatico.ca>
Date: Fri, 06 Apr 2001 12:38:41 GMT
Message-ID: <3ACDB602.9D604D3F@sympatico.ca>

Hi,
Your question isn't the same as your actual query..your query will provide all the distinct order numbers where the orderdate is the max...here's a similar example:

SQL> SELECT ID FROM S_ORD WHERE DATE_ORDERED   2 = (SELECT MAX(DATE_ORDERED) FROM S_ORD);         ID


       110
       111

In your written question you ask for multiple dates, which you'll never get using MAX..

Steve

Ole Christian wrote:

> My problem is like so:
> I want to select multipel orderdates which have the same date as the
> MAX-date of the table.
> But I'm just getting one date, the max date.
> I'm using this command:
>
> select distinct orderenumber from ordertable where orderdate=(select
> max(orderdate) from ordertable)
>
> Ole C.
> PS. I need help quickly...
  Received on Fri Apr 06 2001 - 07:38:41 CDT

Original text of this message

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