Set MySQL variables in WPDB

I am so silly. With this in the end, I set a PHP variable that I needed instead of the “@SET”. My final code was this:

$group_sql = "SELECT product_group FROM insert_temporary LIMIT 1";
    $group = $wpdb->get_var($group_sql);

    $sql = "SELECT * FROM insert_temporary 
WHERE product_group in (SELECT product_group FROM insert_temporary WHERE product_group = '". $group ."' GROUP BY product_group HAVING COUNT(product_group) > 1)";

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

This may help someone 🙂