Updated queries for obtaining multiple rows having max values