SELECT groupfield, MAX(somedata) FROM tablename GROUP BY groupfield