MySQL - Połącz tabele, pobierz tylko Max ID

Widziałem rozwiązania dla czegoś podobnego na innych postach, ale mam problem z ich zastosowaniem do mojego konkretnego problemu.

Oto moje pierwsze połączenie:

SELECT service_note_task, comment_id, comment FROM service_note_task LEFT JOIN service_note_task_comments ON service_note_task.service_note_task_id = service_note_task_comments.service_note_task_id;  

Co skutkuje w:

+-----------------------------+------------+--------------+
| service_note_task           | comment_id | comment      |
+-----------------------------+------------+--------------+
| This is service note task 3 |         25 | Comment      |
| This is service note task 3 |         26 | Comment Blah |
| This is service note task 3 |         36 | aaa          |
| This is service note task 2 |         13 | Awesome comm |
| This is service note task 1 |         12 | Cool Comm    |
+-----------------------------+------------+--------------+

Ale dla każdego zadania service_note_task naprawdę potrzebuję tylko jednego wiersza reprezentującego komentarz z najwyższym komentarzem id, takim jak ten:

+-----------------------------+------------+--------------+
| service_note_task           | comment_id | comment      |
+-----------------------------+------------+--------------+
| This is service note task 3 |         36 | aaa          |
| This is service note task 2 |         13 | Awesome comm |
| This is service note task 1 |         12 | Cool Comm    |
+-----------------------------+------------+--------------+

Myślę, że mogę użyć MAX w instrukcji sub-select, aby zawęzić wyniki tak, jak chcę. Jak mogę włączyć to do mojego oświadczenia, aby uzyskać te wyniki?

questionAnswers(4)

yourAnswerToTheQuestion