Fixed bad SQL query.