I don’t believe that that is included as an option in the default Retrieve action of a microflow. However, you can use OQL to accomplish this: https://docs.mendix.com/refguide/oql-select-clause/
There’s some information/documentation about how to build that yourself using a custom Java action, but there is also a much-used OQL package in the Marketplace: https://marketplace.mendix.com/link/component/66876
Hope this helps!
No, that is not possible using the retrieve-activity. You will need to post-process it with your own custom-created list-sort and looping microflow. But that is always second-best to any other solution that does distinct on database level.
In OQL it is easy:
from yourmodule.yourentity select distinct *