I have an Olympics database from each Olympic year and I want to find the person that has won the most medals.  The main problem is that I'm basically querying the same sub-query twice in SUBSET1 and SUBSET2. How would I go about making this more efficient?Select athlete  FROM ( Select athlete, Sum(total_medals) as total_medalsfrom Olympics Group by athlete) as SUBSET1 Where total_medals = ( Select Max( total_medals ) FROM ( Select Sum(total_medals) as total_medals from Olympics    Group by athlete ) as SUBSET2);
Finding person with most medals in Olympics database
optimization;sql;postgresql