Skip to content

Instantly share code, notes, and snippets.

@vilusa
Last active February 3, 2023 15:22
Show Gist options
  • Save vilusa/ddafcba616368798e1f028713e74cf93 to your computer and use it in GitHub Desktop.
Save vilusa/ddafcba616368798e1f028713e74cf93 to your computer and use it in GitHub Desktop.
customer sql
DELETE FROM customers WHERE id IN(
SELECT id FROM (
SELECT c.id FROM customers c
LEFT JOIN feedbacks f ON c.id = f.creator_id
WHERE
c.node_id = 'b2bfa5ea-579a-46fe-9e45-1ebc8df44082'
AND f.creator_id IS NULL
AND c.email IS NULL
AND c.phone_number IS NULL
AND c.external_id IS NULL
AND c.deleted_at IS NULL
LIMIT 10000
) t
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment