mysql - C# SQL Query Multiple LIKE -
currently i'm making something.
using (var idatabasequery = lightningbolt.getdatabasemanager().createqueryobject()) { idatabasequery.setquery("select * catalogue_baseitems name '%hc2_%' or name '%hc3_';"); data = idatabasequery.fetchtable(); }
that's use, want items beginning hc2_ , hc3_, however, items starting hc2_. in sql contains items starting hc3_ doesn't show while executing query. wrong?
if want items beginning hc2_
or hc3_
, need make 2 changes:
- don't use
%
@ beginning, and - escape underscore because masks "any 1 character"
try this:
select * catalogue_baseitems name 'hc2\_%' or name 'hc3\_%'
note %hc2_%
match of following examples:
abchc2x
(because of leading%
, underscore matchx
)hc23
(because underscore match3
)- ... , on
Comments
Post a Comment