Display current node rank from votes (voting api) in view As in Title. I am struggling by programming but with no luck. Mechanism of voting api is too complicated for me. How can I display current node rank (order number) by votes?

My view now:

Sort critera: 
(Vote results) Vote results: Function desc

Relationships
Node: Vote results

When displaying all results it's have order number thanks to view php field module. 

Display position in rank of current, single node is hell for me. Custom sql query doesn't work at all.

I am using voting api and rate module.

Please help.

EDIT

Since I am using +1/-1 I try to:


Sum +1 Votes
Sum -1 Votes
Subtract sum of -1 votes from sum of +1  


Code:

$plus_rates = db_query("SELECT count(value) AS sum, content_id AS nid FROM votingapi_vote WHERE tag = 'vote' AND value_type = 'points' AND value = 1 GROUP BY content_id ORDER BY sum DESC, nid ASC");
                                         $minus_rates = db_query("SELECT count(value) AS sum, content_id AS nid FROM votingapi_vote WHERE tag = 'vote' AND value_type = 'points' AND value = -1 GROUP BY content_id ORDER BY sum DESC, nid ASC");


                     $pluses = array();
                                         $minuses = array();

                     while ( $row = db_fetch_object($plus_rates) ) {

                                            $pluses[$row-&gt;nid] = $row-&gt;sum;         

                     }

                                         $plus_rates = NULL;

                                         while ( $row = db_fetch_object( $minus_rates ) ) {

                                            $minuses[$row-&gt;nid] = $row-&gt;sum;

                                         }

                                         $minus_rates = NULL;

                                         $keys = array_keys($minuses);

                                         foreach($keys as $k) {

                                                if (array_key_exists($k, $pluses)) {

                                                        $pluses[$k] = $pluses[$k] - $minuses[$k];

                                                }

                                         }

                                         arsort($pluses, SORT_NUMERIC);

                                         firep($pluses, 'pluses');


$pluses is sorted DESC but order is totally different from my view display: 


Sort cirteria: (Vote results) Vote results: Function desc)
Relationship Node: Vote results, Aggregation function: total score


EDIT 2

I try to query votingapi_cache directly but still order is totally different than in views:


  SELECT value, content_id FROM votingapi_cache WHERE value_type =
  'points' AND tag = 'vote' AND FUNCTION = 'sum' ORDER BY value DESC
  LIMIT 0 , 30
Check the comments on this question: Problem visualizing the rating value inside a view

It sounds like you probably haven't set an aggregate function on the Node: Vote Results relationship. You cab definitely display the total votes in a View without writing any of your own code.