Sql server like clause
-
insert into rk_process (code,name,label) values ('01','lee001','aa' ) insert into rk_process (code,name,label) values ('01','lee002','aa' ) insert into rk_process (code,name,label) values ('01','lee003','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) want to filter only (lee) but it showing (leek) also select name from rk_process where name like '%lee%') thanks in advance. Result
lee001
lee002
lee003
leek001
leek001but i need only
lee001
lee002
lee003 -
insert into rk_process (code,name,label) values ('01','lee001','aa' ) insert into rk_process (code,name,label) values ('01','lee002','aa' ) insert into rk_process (code,name,label) values ('01','lee003','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) want to filter only (lee) but it showing (leek) also select name from rk_process where name like '%lee%') thanks in advance. Result
lee001
lee002
lee003
leek001
leek001but i need only
lee001
lee002
lee003 -
insert into rk_process (code,name,label) values ('01','lee001','aa' ) insert into rk_process (code,name,label) values ('01','lee002','aa' ) insert into rk_process (code,name,label) values ('01','lee003','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) want to filter only (lee) but it showing (leek) also select name from rk_process where name like '%lee%') thanks in advance. Result
lee001
lee002
lee003
leek001
leek001but i need only
lee001
lee002
lee003Not tested, but off-hand...
'%lee[0-9]%'
or'%lee[^k]%'
P.S. You didn't specify which database system you are using. And you probably don't need the leading percent sign (%
) -
Not tested, but off-hand...
'%lee[0-9]%'
or'%lee[^k]%'
P.S. You didn't specify which database system you are using. And you probably don't need the leading percent sign (%
)Tested: select name from rk_process where name like '%lee[0-9]%' Yields: lee001 lee002 lee003
-
Not tested, but off-hand...
'%lee[0-9]%'
or'%lee[^k]%'
P.S. You didn't specify which database system you are using. And you probably don't need the leading percent sign (%
)thank you so much PIEBALDconsult
-
insert into rk_process (code,name,label) values ('01','lee001','aa' ) insert into rk_process (code,name,label) values ('01','lee002','aa' ) insert into rk_process (code,name,label) values ('01','lee003','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) insert into rk_process (code,name,label) values ('01','leek001','aa' ) want to filter only (lee) but it showing (leek) also select name from rk_process where name like '%lee%') thanks in advance. Result
lee001
lee002
lee003
leek001
leek001but i need only
lee001
lee002
lee003by using this query you can achive you require output select * from rk_process where name like '%lee0%' --raj :-O