In my WHERE clause, I'm trying to use LIKE for a range of numbers. For example:
WHERE rr.sequence LIKE '05600%'
OR rr.sequence LIKE '05601%'
OR rr.sequence LIKE '05602%'
OR rr.sequence BETWEEN LIKE('056035%' AND '056038%')
Otherwise, I would need to use a LIKE statement for each potential number combination between '056035%' and '056038%'
Kin Shah
62.6k6 gold badges124 silver badges247 bronze badges
asked Jan 17, 2019 at 21:28
1 Answer 1
It looks like you need to do the following:
OR rr.sequence LIKE '05603[5-8]%'
But in general, I agree with Kin's comment on the question: "storing numbers as strings is not a good idea".
answered Jan 17, 2019 at 22:19
lang-sql
like '0560[0-9]%'
? This translates to05601...9
. Also, storing numbers as strings is not a good idea.