fixed impala query 3c