I have a table
`
table VALUES
from UNSIGNED INT
to UNSIGNED INT
value VARCHAR(2) `
example of filling
0,100000,good
100001,200000,better
200001,300000,best
---
etc.
I need to query a value
by number, e.g. 100 (is between 0 and 100000), should return good
199000 should return better, 200002 should return best
What SQL syntax should/can I use?
I’m trying rn to fill the table with exact values from the range, but the process takes too long, there are more then 200k of big ranges.
2
Answers
I found a solution, I had to use
HAVING
statementthere.
I found a solution and the statement like as:
update VALUES
set result = "good"
where
value
between 0 and 100000update VALUES
set result = "better"
where
value
between 100001 and 200000update VALUES
set result = "best"
where
value
between 200001 and 300000