Fix validation SQL