I'm using the mysql GREATEST() function to compare two table fields and display in a loop either one with the highest integer value. The 2 fields consist of vote scores for posts: UP or DOWN.
function vote_results($post_id) {
global $wpdb;
$table = $wpdb->prefix . "post_votes";
$results = $wpdb->get_row( "SELECT GREATEST (up, down) FROM $table WHERE voted_post_id = $post_id" );
echo $results->up; //echo if highest value
echo $results->down; //echo if highest value
}
Then in my loop I call the function but get Notice: Undefined property: stdClass::$up for
echo $results->up;
and the same notice for down. I'm not sure what I'm doing wrong here.

var_dump($results);get you? – Rarst♦ Dec 3 '10 at 16:39object(stdClass)#91 (1) { ["GREATEST(up, down)"]=> string(2) "74"– wpStudent Dec 3 '10 at 16:53