mayank - min max query