I want to use many LIKE conditions in my query. I couldn't find a practical solution. I tried CONTAINS but it doesn't work.
Instead of using this
where EIO.DigiAddress like '%[email protected]%'
or EIO.DigiAddress like '%[email protected]%'
or EIO.DigiAddress like '%[email protected]%'
I want to use something like this:
CONTAINS(EIO.DigiAddress,'%[email protected]%', '%[email protected]%', '%[email protected]%')
OR
EIO.DigiAddress IN ('%[email protected]%', '%[email protected]%', '%[email protected]%')
Try this:
Create a temp table:
CREATE TEMPORARY TABLE temp (
alternate VARCHAR(20)
);
then:
INSERT INTO temp
VALUES ('%[email protected]%'), ('%[email protected]%'), ('%[email protected]%');
Select:
SELECT t.*
FROM tbl t JOIN temp p ON (t.col LIKE p.alternate);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With