I am having trouble using and/or/not operators in my where clause to create the following logic.
I have a field called package that lists out many different names of packages and I need to include/exclude specifically based on the following rules:
If a package includes renew, optout, or discount in the name AND ALSO does not include premium in the name, those names need to be excluded from the dataset. (so If a package has renew, optout, or discount in the name and the word premium, these are included in the dataset)
Furthermore, Anything with employee or Comp needs to be excluded.
Anything else not listed in the rules above would be included in the dataset.
Any help would be greatly appreciated and added to my sql tool belt!
Sounds like something like:
SELECT * FROM packages WHERE name NOT LIKE '%employee%' AND name NOT LIKE '%Comp%' AND (name NOT LIKE '%renew%' OR name NOT LIKE '%optout%' OR name NOT LIKE '%discount%') OR name LIKE '%premium%')