In this paper, we focus on the query problem of trajectory tracking of moving targets in a wireless sensor network. Our motivation is to design in-network storage and querying protocols to support queries for searching a given target signature in a low query latency, high query reliability, and energy efficient manner. We propose a target trajectory query protocol, which combines index-based query and random query schemes. The query protocol guarantees query reliability and energy efficiency. In an index-based queries scheme, each target trajectory has an index, which is stored at an index node (designated node). Query nodes send query messages to the index node to get results. Naturally, index-based queries can guarantee query reliability, but the disadvantage is the query hotspot problem, which reduces the lifetime of the sensor network. A random queries scheme, which is based on opportunistic target signature propagation, sends query messages in random chosen directions to hit a sensor node that contains the given target signature near the query node. However, queries for targets whose signature propagation is very limited need a large number of random query messages to achieve high query reliability. Our algorithm combines the two query schemes. It takes advantages of both of them, and eliminates each individual's disadvantages. Performance analysis and simulation studies show that our query protocol is superior to index-based queries in terms of the query hotspot problem, and it is superior to random queries in terms of energy efficiency, query latency, and query reliability.