Fixed a missing parenthesis in SQL query