Corrected some syntax in the sql.