def visit_binary(self, binary, **kwargs):
"""Move bind parameters to the right-hand side of an operator, where possible."""
- if isinstance(binary.left, expression._BindParamClause) and binary.operator == operator.eq:
+ if isinstance(binary.left, expression._BindParamClause) and binary.operator == operator.eq \
+ and not isinstance(binary.right, expression._BindParamClause):
return self.process(expression._BinaryExpression(binary.right, binary.left, binary.operator), **kwargs)
else:
return super(MSSQLCompiler, self).visit_binary(binary, **kwargs)