Added test cases to testHavingInSubquery