public static function organizePriorities($tableName, $priorColumnName, $whereCondition = '', $orderBy = '', $startBy = 1)
{
// Datenbankvariable initialisieren
$qry = 'SET @count=' . ($startBy - 1);
$sql = rex_sql::factory();
$sql->setQuery($qry);
// Spalte updaten
$qry = 'UPDATE ' . $tableName . ' SET ' . $priorColumnName . ' = ( SELECT @count := @count +1 )';
if ($whereCondition != '') {
$qry .= ' WHERE ' . $whereCondition;
}
if ($orderBy != '') {
$qry .= ' ORDER BY ' . $orderBy;
}
$sql->setQuery($qry);
}