Use of in Function

  • Whenever a field needs to be tested against a list of valid values it is recommended to use the IN function and not compare the field against each and every value.
  • Wrong way:
    • Select ...
    • From ...
    • Where ... (A = '10' or A='20' or A='30')
  • Right way:
    • Select ...
    • From ...
    • Where ... A IN ('10','20','30')