how to get up row in wordpress with wpdb

you should add another field to your prices table called previous_id and keep it updated on every insert and delete query.

This way you may always have the track for previous record. If you deletethat record, you may assign its previous_id into the next record and if you insert new record, you may add the last available id into its previous_id.