Skip to content

Instantly share code, notes, and snippets.

@remvee
Created September 21, 2020 09:47
Show Gist options
  • Save remvee/333718877de561caf4e0d979895dfbb0 to your computer and use it in GitHub Desktop.
Save remvee/333718877de561caf4e0d979895dfbb0 to your computer and use it in GitHub Desktop.
MD5 sum a query result in PostgreSQL
SELECT md5(array_agg((t.*)::varchar)::varchar)
FROM (
SELECT users.*, departments.name FROM users INNER JOIN departments.id ON users.department_id
) as t;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment