You can filter on rows whose first column is equal to or less than the parameter,
order by descending value in that column, and keep the top row only, using
Assuming that the filtering column is called
select * from mytable where id <= ? order by id desc limit 1
The question mark represents the parameter to the query.
CLICK HERE to find out more related problems solutions.