I'm trying to write this querry:

    SET @rownumber = 0;
    UPDATE #__hikers SET rank = (@rownumber:=@rownumber+1)
    ORDER BY score DESC;

like JDatabaseQuery, but still got an error. Please help

UPDATE:
I tried this code:

    $db = JFactory::getDbo();
    $query = $db->getQuery(true);
    $query->set($db->quote(@rownumber = 0));
    $query->update($db->quoteName('#__hikers'));
    $query->set($db->quoteName('#__rank') . ' = ' .$db->quote(@rownumber:=@rownumber+1));
    $query->order('score DESC');
    $db->setQuery($query);
    $result = $db->execute();