Skip to content

Instantly share code, notes, and snippets.

@abrkn
Created November 11, 2012 15:24
Show Gist options
  • Save abrkn/4055217 to your computer and use it in GitHub Desktop.
Save abrkn/4055217 to your computer and use it in GitHub Desktop.
SELECT o,side, o.price, sum(o.volume)
FROM active_order o
WHERE o.side = 0
GROUP BY o.price, o.side
ORDER BY o.price DESC
LIMIT 50
UNION ALL
SELECT o.side, o.price, sum(o.volume)
FROM active_order o
WHERE o.side = 1
GROUP BY o.price, o.side
ORDER BY o.price ASC
LIMIT 50;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment