This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Selecting the distinct values from three columns with the max of a fourth where there are duplicates

By: a guest on Feb 26th, 2012  |  syntax: None  |  size: 0.11 KB  |  views: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. select max(n), a, b, c
  2. from mytable
  3. group by a, b, c
  4.        
  5. select a, b, c, max(n)
  6. from table
  7. group by a, b, c;
clone this paste RAW Paste Data