An approximate algorithm for median query(AAMQ) based on WSN was proposed.In AAMQ
each node could estimate the value of the distinct number
and created a subsequence samples which get K percent of the most com-monly used values in its own observed values
and then broadcasted its subsequence to the parents.Finally
these samples were combined to a single sample in the root node which its data structure was far smaller than the size of the whole data set.The approximate value for median query could be introduced from the sample quickly.Experimental results show that the proposed algorithm can greatly reduce the communication