Skip to content
Advertisement

Compare Existence Of The Same Field A Based On Field Batch [closed]

A table has fields

  • code
  • batch

I want to know what code(s) are in batch 1 but not in batch 2. What is the best SQL statement for this?

Advertisement

Answer

There are multiple options as follows:

Using NOT EXISTS:

Using LEFT JOIN:

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