Please have a look at DISTINCT ON and post your best attempt.
Without showing an attempt, your question will draw downvotes.