Skip to content

Instantly share code, notes, and snippets.

@cmcaine
cmcaine / diff-example.sql
Last active September 8, 2023 03:13
Diff SQL Select statements
/*
Show row differences between SELECT statements `new` and `old`.
The first column ("diff") will contain a '+' for rows that are in new and not in old
and a '-' for rows that are in old and not in new. The rest of the columns are whatever
new and old return.
If the rows in new and old share ids, then you may want to add an "ORDER BY" at the end
of the outer SELECT to make the two versions of the rows appear next to each other.