Fixed SQL errors with SQLServer (column specified more than once in the order by list) after r13526.

git-svn-id: http://svn.redmine.org/redmine/trunk@13527 e93f8b46-1217-0410-a6f0-8f06a7374b81