Due to the proliferation of low cost wireless sensors, there is growing research interest in their applications, for example, in home healthcare and location tracking. However, due to sensors’ energy resource constraint, some possible applications of sensors have been restricted. In particular, in applications concerning deployment of mobile sensors in dynamic environments, high amounts of energy are consumed by sensors to maintain routing tables. Although existing methods have been proposed to query data from sensors without the use of any routing tables, these methods typically require redundant data to be sent back to the sink and not all of the aggregation functions could be executed precisely. In this paper, we modify an existing method to provide more accurate query answers and extend the lifetime of a wireless sensor network (WSN). According to our simulation, this method outperforms the existing method our approach modifies.