SELECT DISTINCT
  *
FROM test
GROUP BY
  foo
, bar
ORDER BY
  foo ASC
, bar DESC
LIMIT 10 OFFSET 2
