I’m trying to create a stored procedure like followed
…Having (IF(input_val between 1 and 10, 1,0) AS rank
example
|input_val | rank |
--------------------|
| 1 | 1 |
| 11 | 0 |
| 3 | 1 |
| 22 | 0 |
| 4 | 1 |
| 5 | 1 |
A HAVING clause normally follows a GROUP BY clause and is used to test the results of an aggregate function. I don’t think that’s appropriate for what you want here. How about: