Skip to content
Advertisement

SQL compare rows between groups and show the missing

I have the following data from a SQL DB. There are 98 columns in total this is an extract of 4 to illustrate what I would like to to and in the final query I would expect to require 51 of them. There are 15 million rows to this table.

This table shows each change to a subscription. We can see;

  • At version 3 Module Support is added
  • At version 4 Online Support is removed
  • At version 5 Premium Support is added
  • At version 6 Premium Support is removed
  • At version 7 Online Support is added

What I want to do is run a query that will return rows missing from the current version that were present in the previous version, as below.

Is this possible?

Advertisement

Answer

I don’t generally think of FULL OUTER JOIN, but indeed that works too.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement