fixed error in places sql query