Fixed another error in SQL queery