Hacker News new | past | comments | ask | show | jobs | submit login

Using row values in PG:

  SELECT count(q.*)
  FROM (SELECT a, b FROM table_a a
        NATURAL FULL OUTER JOIN table_b b
        WHERE a IS NOT DISTINCT FROM NULL
           OR b IS NOT DISTINCT FROM NULL) q;
This looks for rows in `a` that are not in `b` and vice-versa and produces a count of those.

The key for this in SQL is `NATURAL FULL OUTER JOIN` (and row values).




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: