check that queries are grouped together