title: Select values with duplicate max values sql
body: <p>I have a table made up of dates and sales totals for the particular date. I would like to be able to query the table and select the following: max sales,  the date associated with the max sale figure, sum of all sales,  and the minimum date in the table. One additional complication is that there are duplicate max values. I don't care which max value is chosen but I just want one at random. This is for Oracle. </p>
  
  <p>Here is what I tried. It was using a sub query. </p>
  
  <pre><code>Select sales,  date,  min(date),  sum(sales)  from table
      Where sales = (select distinct(max(sales)) from table) 
  </code></pre>