SQL SELECT WHERE field contains words

0 votes

I require a SELECT command which will return the following to me:

SELECT * FROM Table WHERE Column1 CONTAINS 'w1 w2 w3'

And I need all of the results, so strings containing 'w2 w3 w1' or 'w1 w3 w2' or any other combination of the three are OK.

All words must appear in the final product.

Feb 21 in Database by Vaani
• 5,240 points
174 views

1 answer to this question.

0 votes

Use this query to include any of words:

SELECT * FROM mytable
WHERE Column1 LIKE '%w1%'
   OR Column1 LIKE '%w2%'
   OR Column1 LIKE '%w3%'

If you require all words, use this:

SELECT * FROM Table
WHERE Column1 LIKE '%w1%'
  AND Column1 LIKE '%w2%'
  AND Column1 LIKE '%w3%'

answered Feb 21 by Neha
• 6,260 points

Related Questions In Database

0 votes
1 answer

IN vs OR in the SQL WHERE Clause

I assume you want to know the ...READ MORE

answered Sep 24, 2018 in Database by DataKing99
• 8,240 points
435 views
0 votes
2 answers

How to select the nth row in a SQL database table?

SELECT * FROM ( SELECT ID, NAME, ROW_NUMBER() ...READ MORE

answered Apr 23, 2020 in Database by anand
• 140 points
15,526 views
0 votes
1 answer

SQL Switch/Case in 'where' clause

Without a case statement: SELECT column1, ...READ MORE

answered Feb 7 in Database by Vaani
• 5,240 points
49 views
0 votes
1 answer

How do I perform an IF THEN statement in an SQL SELECT?

The CASE statement is the closest to IF in ...READ MORE

answered Feb 16 in Database by Vaani
• 5,240 points
38 views
0 votes
1 answer

How do I UPDATE from a SELECT in SQL Server?

MERGE INTO YourTable T USING ...READ MORE

answered Feb 3 in Database by Vaani
• 5,240 points
39 views
0 votes
0 answers

How do I UPDATE from a SELECT in SQL Server?

INSERT INTO Table (col1, col2, col3) SELECT col1, ...READ MORE

Feb 4 in Database by Vaani
• 5,240 points
14 views
0 votes
0 answers

How do I UPDATE from a SELECT in SQL server?

can we  update a table with SELECT? A temporary table ...READ MORE

2 days ago in Others by polo
• 140 points
6 views
0 votes
0 answers

How can we UPDATE from a SELECT in an SQL Server

In an SQL Server, we can insert rows ...READ MORE

1 day ago in Others by avinash
• 140 points
9 views
0 votes
2 answers

Case in Select Statement

I think these could be helpful for ...READ MORE

answered Feb 4 in Database by Neha
• 6,260 points
46 views
0 votes
1 answer

Ordering by the order of values in a SQL IN() clause

Use MySQL's FIELD() function: SELECT name, description, ... FROM ... WHERE id ...READ MORE

answered Feb 4 in Database by Neha
• 6,260 points
216 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP