Fixed nondeterminism in MySQL queries