i want to search a column data contain some letters like OP or OPS.
desp
--------
9037OP
3HTVO开发者_StackOverflowPS
G4OP568H
select * from table WHERE desp LIKE '%OP' OR '%OPS' order by desp desc
if try this query its returned only '9037OP'
I think the correct query should be
This is when OP
and OPS
shoule be found only at the end of the string
select * from table `desp` WHERE `desp` LIKE '%OP' OR `desp` LIKE '%OPS' order by `desp` desc
and for OP
, OPS
anywhere in the string
select * from table `desp` WHERE `desp` LIKE '%OP%' OR `desp` LIKE '%OPS%' order by `desp` desc
精彩评论