Get count of rows based if column exists in two different tables

You need to use a join in your mysql query.

Something like this might get you closer…

global $wpdb;
$rsvp_table = $wpdb->prefix . 'rsvp';
$invites_table = $wpdb->prefix . 'invites';

$sql="SELECT COUNT(*) as count 
FROM $invites_table i1 
JOIN $rsvp_table r1 ON (r1.reference = i1.reference)";

$yet_to_respond = $wpdb->get_results( $sql );

echo $yet_to_respond->count;