Fixed problem in SQL query.