Skip to content

Instantly share code, notes, and snippets.

@kerbelp
Created December 31, 2016 16:32
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kerbelp/9f4bb1d36b50b6a67caf8897969aabe3 to your computer and use it in GitHub Desktop.
Save kerbelp/9f4bb1d36b50b6a67caf8897969aabe3 to your computer and use it in GitHub Desktop.
SELECT stv_tbl_perm.db_id,
stv_tbl_perm.id,
stv_tbl_perm.name,
SUM(stv_tbl_perm. "rows") AS "rows",
SUM(stv_tbl_perm. "rows") - SUM(stv_tbl_perm.sorted_rows) AS unsorted_rows
FROM stv_tbl_perm
GROUP BY stv_tbl_perm.db_id,
stv_tbl_perm.id,
stv_tbl_perm.name;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment