bug-4473: incorrect result count when having clause is used w/o group by

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>
Fix merge conflict

Signed-off-by: Marc Delisle <marc@infomarc.info>