psql -p 5002 cb -c "SELECT md5hash FROM banning_blacklist a WHERE id IN (SELECT max(id) FROM banning_blacklist b WHERE a.md5hash=b.md5hash AND delete_user_id IS null);"
psql -p 5002 cb -c "COPY (SELECT md5hash FROM banning_blacklist a WHERE id IN (SELECT max(id) FROM banning_blacklist b WHERE a.md5hash=b.md5hash AND delete_user_id IS null)) to '<path>/<filename>.csv' WITH CSV HEADERS"