Remove syntax error from sql