A data querying scheme is introduced for sensor networks where queries formed for each sensing task are sent to task sets. The sensor field is partitioned into subregions by using quadtree based addressing, and then a given number of sensors from each subregion are assigned to each task set by using a distributed algorithm. The number of nodes in a task set depends on the task specifications. Hence, the sensed data is retrieved from a sensor network in the level of detail specified by users, and a tradeoff mechanism between data resolution and query cost is provided. Experiments show that the dynamic task sets scheme systematically reduces the number of sensors involved in a query in the orders of magnitude in the expense of slight reduction in the event detection rate. (c) 2005 Elsevier B.V. All rights reserved.