I could use some guidance to select all products where the 2nd position of the string is equal to P or J or W or Z or G or any of another dozen defined letters. Is there a way to do this without just copying/pasting the LOCATE for each valid option in this example?
This could get clunky:
...OR LOCATE("P", `Type`) = '2'
OR LOCATE("J", `Type`) = '2'
OR LOCATE("W", `Type`) = '2'
OR LOCATE("Z", `Type`) = '2'
OR LOCATE("G", `Type`) = '2'...
Is there a better way?
Code:
SELECT DISTINCT `Type`
FROM products WHERE LOCATE("P", `Type`) = '2' OR LOCATE("J", `Type`) = '2'
ORDER BY `Type`
This could get clunky:
...OR LOCATE("P", `Type`) = '2'
OR LOCATE("J", `Type`) = '2'
OR LOCATE("W", `Type`) = '2'
OR LOCATE("Z", `Type`) = '2'
OR LOCATE("G", `Type`) = '2'...
Is there a better way?