}
Expression expr = SymbolMap.getExpression(querySymbol);
if (!previousExpressions.add(expr) || (queryCommand instanceof Query && EvaluatableVisitor.willBecomeConstant(expr))) {
orderBy.removeOrderByItem(i--);
} else if (!isUnrelated) {
orderBy.getOrderByItems().get(i).setSymbol((SingleElementSymbol)querySymbol.clone());
} else {
hasUnrelatedExpression = true;
}
}
if (orderBy.getVariableCount() == 0) {