fix bug 972165 - group by buildid, and also don't both with count query