3
Reply

Like pattern in sql query

mangai vellingiri

mangai vellingiri

Jul 24 2015 12:19 AM
480
Sir,
 
 I have doubt in sql query like pattern. Consider the scenario,
 roll no
 name
 1 karnan
 2 karan
Now i want to retrieve the name with middle character 'n'. If i use query  select * from tablename where name like '%n%', it retrieves the name karnan and karan. But my scenario is to retrieve only the character with 'n' in middle. In karan, 'n' is at end. The end character may anything but my scenario is i want name with 'n' in middle. What query i can use here?

Answers (3)