Answers.Body: <p>18 months later and SK can now do this with the 'First' transformation:</p>
  <p><a href="https://i.sstatic.net/Yt6m7.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Yt6m7.png" alt="enter image description here" /></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-12-13T08:50:04.460Z
Answers.LastActivityDate: 2023-12-13T08:50:04.460Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>I played around with this a bit and the closest I got was to create a table of top donations <em>not</em> grouped by contact. I know it's not what you asked for, but it could be serviceable. If I were a fundraising officer I'd probably want to know that the top 1, 2, and 3 donations were actually all from the same person rather than have that fact hidden by the GROUP BY which would make it look like the 4th top donation was really the 2nd.</p>
  <p>To get exactly what you asked for, we'd probably have to implement the sometimes requested feature of creating a search from the results of another search.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-07-19T15:06:27.587Z
Answers.LastActivityDate: 2022-07-19T15:06:27.587Z
Answers.UserDisplayName: Coleman
Body: <p>Suppose I want to display a table of largest contribution per contact AND its date.</p>
  <p>Consider:</p>
  <p><a href="https://i.sstatic.net/PrSTc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PrSTc.png" alt="enter image description here" /></a></p>
  <p>This search produces the contact name, a list of amounts and a list of dates.</p>
  <p>Changing the field transformation function of Total Amount from 'List' to 'Max' produces the largest amount.  The problem is in getting the date associated with that largest amount.</p>
  <p>SK ends up producing an SQL statement, and looking at the problem from a SQL perspective, there is a section of the <a href="https://dev.mysql.com/doc/refman/8.0/en/example-maximum-column-group-row.html" rel="nofollow noreferrer">MySQL manual</a> addressing this. So there are various ways in can be achieved in SQL, but can SK produce such SQL?</p>
  <p>Please note: This largest contribution question is just an example of the more general question of selecting data associated with a max/min field with SK, so I'm not looking for solutions involving things like Summary Fields (useful as it is!).</p>
  
Tags: <searchkit>
Title: SearchKit: how to find largest contributions?
ThreadText: # SearchKit: how to find largest contributions?
  
  (Asked by: username_0 on 2022-07-14)
  
  Suppose I want to display a table of largest contribution per contact AND its date.
  
  Consider:
  
  [![enter image description here](https://i.sstatic.net/PrSTc.png)](https://i.sstatic.net/PrSTc.png)
  
  This search produces the contact name, a list of amounts and a list of dates.
  
  Changing the field transformation function of Total Amount from 'List' to 'Max' produces the largest amount. The problem is in getting the date associated with that largest amount.
  
  SK ends up producing an SQL statement, and looking at the problem from a SQL perspective, there is a section of the [MySQL manual](https://dev.mysql.com/doc/refman/8.0/en/example-maximum-column-group-row.html) addressing this. So there are various ways in can be achieved in SQL, but can SK produce such SQL?
  
  Please note: This largest contribution question is just an example of the more general question of selecting data associated with a max/min field with SK, so I'm not looking for solutions involving things like Summary Fields (useful as it is!).
  
  **Tags:** searchkit
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2023-12-13. Score: 2
  
  18 months later and SK can now do this with the 'First' transformation:
  
  [![enter image description here](https://i.sstatic.net/Yt6m7.png)](https://i.sstatic.net/Yt6m7.png)
  
  
  ---
  
  ### Answer by username_1 on 2022-07-19. Score: 0
  
  I played around with this a bit and the closest I got was to create a table of top donations *not* grouped by contact. I know it's not what you asked for, but it could be serviceable. If I were a fundraising officer I'd probably want to know that the top 1, 2, and 3 donations were actually all from the same person rather than have that fact hidden by the GROUP BY which would make it look like the 4th top donation was really the 2nd.
  
  To get exactly what you asked for, we'd probably have to implement the sometimes requested feature of creating a search from the results of another search.
  
  
  ---
  
  