Select two sums with single get_var statement

$wpdb->get_var will do exactly what the name suggests– return a single value. So this:

$sum = $wpdb->get_var("select sum(first), sum(second) from sums_test where id > 1");
var_dump($sum);

Will return the result of sum(first). The rest of the result is lost (though cached I believe).

The method you want is get_row which will return a complete row of results.

$sum = $wpdb->get_row("select sum(first) as first_sum, sum(second) as second_sum from sums_test where id > 1");
var_dump($sum);

I have added AS clauses as well to make it easier to use the data in PHP. You can now get your results with $sum->first_sum), $sum->second_sum, and so on for as many as you retrieve, or you may use something something more dynamic like:

foreach ($sum as $k=>$v) {
  echo $k.' -> '.$v.'<br>';
}