my programming has been on iSeries using RPG. I am trying to mimic the behavior of test for the existence of a key in the table, (in RPG this would set the cursor at; or at the next record to the key I want) if the key is found, I can do a read (select) from there; if the key is not found, I want to position to the record (row) prior to where the key should be and read (select) from there. so... I would: SELECT EXISTS(SELECT * FROM table1 WHERE ...) I will have a record or not, if not, how do I get the record that is just prior to the one I want that does not exist? (I am on MySQL 8.0 and Windows 7 64 bit if it is important) <br>