error in Max keyword
DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: error in Max keyword

  1. #1
    Join Date
    Oct 2002
    Posts
    18

    error in Max keyword

    I have a table (tableX, say)with the following columns:


    Day sales
    0 60
    1 61
    2 65
    . .
    .
    .
    50 70

    I wanted to get the max value of sales and the corresponding day and wrote "select max(sales), day from tableX" but i get an error message.

    What could be the reason?

  2. #2
    Join Date
    Aug 2002
    Posts
    115
    select sales,day
    from tablex
    where sales=(select max(sales) from tablex)

  3. #3
    Join Date
    Aug 2002
    Location
    Colorado Springs
    Posts
    5,253
    or...
    Code:
    Select
       day,
       sales
    From
       (
       Select
          day,
          sales,
          max(sales) over () max_sales
       from
          tablex
       )
    Where
       sales = max_sales
    /
    David Aldridge,
    "The Oracle Sponge"

    Senior Manager, Business Intelligence Development
    XM Satellite Radio
    Washington, DC

    Oracle ACE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width