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

With reference to this stackoverflow post: http://stackoverflow.com/questions/24384953/phpmyadmin-incorrect-results-count

Signed-off-by: Chirayu Chiripal <chirayu.chiripal@gmail.com>