MySQL Select with alpha wildcards not working -
i have simple table of single column rows of char(12)
like:
drf4482 drf4497 drf451 drf4515 ehf452 fjf453 gkf4573
i want select of rows between d
, f
, , have 4 numbers @ end. drf4482
, drf4497
, drf4515
, etc. i've tried number of different wildcard combinations no rows. i'm using:
select * `expired` id '%[d-f][a-z][a-z]____';
i've tried broaden to:
select * `expired` id '%[d-f]%';
and returns nothing well.
i've tried collate latin1_bin
based on other posts didn't work either. table utf8
, i've created second table latin1
, tried few different collations same results - no rows.
where error?
you need use regexp
instead of like
. notice syntax little different; doesn't sqlish %
wildcard characters.
so, want
id regexp '[d-f][a-z][a-z][0-9]{4}'
for app. don't have multibyte characters in these strings, because mysql's regexp doesn't work correctly in circumstances.
Comments
Post a Comment