how do i do a query that i want the next lowest number higher then a certain number
so for example if i have data like in the id step_number
1
3
4
5
6
if i just want the next highest number higher then 1…but i dont know the numbers they vary every time. I just know i need the next lowest number higher then a number. So in this case i would want 3 returned
select step_number from system_step_product where step_number > 1
order by step_number asc limit 1;
this works but is there a better way
Your solution might be the most performant, but another solution that would work in other DB’s would be:
Indexing that column is also probably a good idea.