support for min and max queries