Full outer join style reconciliation
SQL
Medium
3 views
Problem Description
You have table A_ids(id) and B_ids(id). Show ids that are missing on either side.
Sample Test Case
Output:
Reconciliation list
Constraints
If FULL OUTER JOIN not available, use UNION
Official Solution
SELECT COALESCE(a.id, b.id) AS id, CASE WHEN a.id IS NULL THEN 'MISSING_IN_A' WHEN b.id IS NULL THEN 'MISSING_IN_B' ELSE 'BOTH' END AS status FROM A_ids a FULL OUTER JOIN B_ids b ON a.id = b.id;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!