I am working on this query where I have two tables ticket and comments. Now the condition is I need to fetch the latest note(timestamp) from the other table based on one field there ie: updatedAt. This is the query I am trying to get but getting errors.
SELECT t.id, t.title, t.requesterEmail, t.createdAt, c.note , t.priority, t.assigneeEmail, t.status
FROM ticket t inner join comments c on c.ticketid = t.id
WHERE assigneeEmail = 'bhavya.aggarwal@gmail.com' and status = 'Open' and c.updatedat = max(c.updatedat)
What query should i run to meet this condition.