In sensor networks, the event-detection process can be considered as a join of two relations, i.e., a sensor table and a condition table, where a condition table is a set of triples each of which contains condition information about a certain event. When join operations are used for event-detection, it is desirable, if possible, to perform 'in-network' joins in order to reduce the communication cost. In this paper, we propose an in-network join algorithm, called HIPaG. In HIPaG, a condition table is partitioned into several fragments. Those fragments are stored either in paths from the base station to sensor nodes, or in groups of nodes each of which are within the broadcast range among each other. By distributing a condition table in this way, a distributed join of a sensor table and a condition table can be effectively performed in the network. The experimental results show that our proposed HIPaG works much better than the existing method. (C) 2009 Elsevier Inc. All rights reserved.