I am writing a Custom Query in WordPress database to get the previous record from the posts table.
Example: I have an ID of 34975; after I query the database I should get the ID as 34972, which is the previous record ID.
SQL
$results = $wpdb->get_results( "SELECT * FROM agencies_posts WHERE ID = '34975 ' LIMIT 1", OBJECT );
foreach( $results as $item ){
$previous_depature_port = $item->ID;
}