In-network aggregation has been proposed as one method for reducing energy consumption in networked sensors. In this paper, we explore the idea of influencing the construction of the routing trees for sensor networks with the goal of reducing the size of transmitted data for networks with in-network aggregation involving Group By queries. Toward this, we propose a group-aware network configuration method and present two algorithms, that “cluster” along the same path sensor nodes which belong to the same group. We evaluate our proposed scheme experimentally, in the context of existing in-network aggregation schemes, with respect to energy consumption and quality of data. Overall, our routing tree construction scheme provides energy savings over existing network configuration schemes and improves quality of data in systems with imperfect quality of data such as TiNA.