Reputation: 15
I would like to search my database for any varchars with 'C' as the second letter.
I have tried "like '%C%'" but that returns values with C anywhere.
I am using mysql just in case that matters.
Upvotes: 1
Views: 1102
Reputation: 1
This is another solution:
select *
from yourTable
where instr('c', yourColumn)!=2;
the instr() function returns an integer which indicates the position of the first occurrence of the substring in the first argument within the string on the second argument.
Upvotes: 0
Reputation: 65547
You can use _
, which is the single character wildcard.
For example:
select *
from your_table
where your_column like '_C%'
Upvotes: 2