Subject Re: [firebird-support] between operator on a varchar field
Author Ivan_P=c5=99enosil
> I have a query with a between operator on a non-indexed varchar(30)
field – currently on FB 2.5 :
>
> … where MYFIELD between ’AHH00091/2017’ and ’AHH00141/2017’
>
> I would expect 51 records from 91 to 141 all ending with /2017 but
> surprisingly, records ending with /2016 or /2015, etc. also appear in
the resultset ( so I have to put other criteria e.g. and MYFIELD like
'%/2017' )

e.g.
WHERE MYFIELD SIMILAR TO 'AHH[0-9]{5}/2017'
AND SUBSTRING(MYFIELD FROM 4 FOR 5) BETWEEN '00091' AND '00141'

I.