Is there a built-in function or some other way to limit the value of numbers in MySQL?
For example, let's say I have a table with the following rows:
score
=====
5
10
20
50
3
15
I'd looking for some type of query along the lines of...
SELECT NUMBER_LIMITER(score, 10) FROM ScoresTable
...which would return the following result...
score
=====
5
10
10
10
3
10
If not, I'll write a function. Just hoping there might be something built-in as performance is quite important for this project. Thanks!
SELECT LEAST(score, 10) FROM ScoresTable
http://dev.mysql.com/doc/refman/5.5/en/comparison-operators.html#function_least
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With