Thanks for asking your question on the forum. When using the ‘Retrieve from database’ action, you likely used an xPath with something like ‘ticketId=X’. In addition to that, you can set the Range to ‘First’. Last but not least, you need to add sorting on the ‘createdDate’, descending.
Hopefully, this helps.