In Wordpress, I am attempting to add the publish ID of posts I publish inside a new table otherwise already there (to prevent double records when upgrading posts in the admin panel)

if( $wpdb->get_row("SELECT post_id FROM wp_post_votes WHERE post_id != $post_ID" ) ) {
    $wpdb->insert( $wpdb->prefix . 'post_votes', array( 'post_id' => $post_ID ) );
    }

This statement works just with a = operator as well as an "else ( do code.. ". With != nothing happens I can not understand why.. Among the finest to help keep the code as short as you possibly can.

Try

if( !$wpdb->get_row("SELECT post_id FROM wp_post_votes WHERE post_id = $post_ID" )
if(!($wpdb->get_row("SELECT post_id FROM wp_post_votes WHERE post_id = $post_ID" ) ) ) {
    $wpdb->insert( $wpdb->prefix . 'post_votes', array( 'post_id' => $post_ID ) );
}

Ought to be what you are searching for. (Added a ! prior to the conditional to simulate your "else" effect)

Your if statement is checking the output from

$wpdb->get_row("SELECT post_id FROM wp_post_votes WHERE post_id != $post_ID" )

examines to some true-like value. You are basically managing a query that chooses all IDs all rows (aside from possibly one). This really is inefficient and most likely not that which you wanted - you most likely wanted to see if an identical row wasn't found, not too non-matching rows put together.

You most likely want:

if (!$wpdb->get_row("SELECT post_id FROM wp_post_votes WHERE post_id = $post_ID" )) {