I am looking for a way to select the max id value in a table under a specified value. I am trying to use the following query
select max(id) as 'maxid' from proveedor where 'id' < 6666
The value I am expecting is 3, but instead I get 7777. Is there a different way to do this?
+-------+
| id |
+-------+
| 1 |
| 2 |
| 3 |
| 6666 |
| 7777 |
+-------+