I have 2 different columns in the same table, and I want to select lines which contain the word “Hello”.
For the first column, I’m using this SQL statement:
SELECT * FROM table1 WHERE column1 LIKE '%Hello%';
So what statement can I do to select everything in both columns?
Thanks for your help !
Advertisement
Answer
This is a bit of a guess, because it’s no easy to understand what you mean
SELECT * FROM table1 WHERE column1 LIKE '%Hello%' OR column2 LIKE '%Hello%';
If you mean that you want both columns to have “hello” in:
SELECT * FROM table1 WHERE column1 LIKE '%Hello%' AND column2 LIKE '%Hello%';