implement having clause analysis