Reputation: 31
Let's say I have multiple 6 character Alphanumeric strings. abc123
, abc231
, abc456
, cba123
, bac231
, and bac123
.
Basically I want a select statement that can search and list all the abc
instances.
I just want a select statement that can list all instances with keyword "abc".
Upvotes: 3
Views: 136
Reputation: 1888
You can use LIKE
operator in sql
Select * From Table Where Column LIKE 'abc%';
Select * From Tablo Where Column Like '%abc';
Select * From Table Where Column LIKE '%abc%';
So If you want to use escape character in LIKE
condition , you must make small changes on your condition
For Example :
SELECT * FROM Table WHERE column LIKE '!%' escape '!';
More information for you is here
Upvotes: 0
Reputation: 15061
Use LIKE
and wildcards %
SELECT *
FROM yourtable
WHERE yourfield LIKE '%abc%'
Input
yourfield
abc123
abc231
abc456
cba123
bac231
bac123
Output:
yourfield
abc123
abc231
abc456
SQL Fiddle:
Upvotes: 4
Reputation: 1185
Select * from tablename
where yourfield like 'yourconstantcharacters%'
Upvotes: 0
Reputation: 458
Could you try like this way
SELECT *
FROM yourtable
WHERE field LIKE '%a%' Or field LIKE '%b%' Or field LIKE '%c%'
Upvotes: 0