Adjusted SQL syntax. #1177