Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 21st, 2012  |  syntax: None  |  size: 0.31 KB  |  hits: 13  |  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
  2.   documents.id,
  3.   documents.title,
  4.   documents.version,
  5.   documents.content
  6. FROM
  7.   documents
  8.   JOIN (
  9.     SELECT
  10.       title,
  11.       MAX(version) AS version
  12.     FROM documents
  13.     GROUP BY title
  14.   ) maxversions ON (documents.title = maxversions.title AND documents.version = maxversions.version)