How will write a select query where a date field should be maximum out of all values present for that field?