Reputation: 195
i have table like below
ID | Place
-------------
0 | BANGALORE
1 | BEGUR
Now in this table, i need a query which returns the rows when i search like 'BR'. BR terms are present in both rows, is there a way to search string like this?
Upvotes: 1
Views: 170
Reputation: 7746
Use SQL Wildcards
SELECT * WHERE place LIKE "%B%R%"
Reference
http://www.w3schools.com/sql/sql_wildcards.asp
Upvotes: 1
Reputation: 369
It seems simple enough following my understanding.
SELECT * FROM TableName WHERE Place LIKE 'BR%';
Recommendation: w3school
Upvotes: -1
Reputation: 549
This query will find the strings which contains the letters 'B' and 'R' any where in the string!!
select Place from table_name where Place like "%B%" and Place like "%R%";
Hope this helps!
Upvotes: 1
Reputation: 93724
Use LIKE
operator. This will return rows which has the word 'B'
before 'R'
in any position
select * from tablename where Place like '%B%R%'
Upvotes: 3