Build a query to select max value for a particular atribute

I have a data type called check in where I store the member id and membership expiry date. Every time a member renews the membership, the expiry date gets updated to today or sometime in future depending on daily/monthly membership.

How can I show the membership expiry date for a member in a text field? the sql query will be

select max(membership expiry date) from check-in where member-id=xyz.

Do a search, sort on Expiry Date then select the highest using : first item