Hi Gunjan,
I can think of a couple of solutions here.
1>.Create a query for pulling all data which has condition userkey is not empty and then deduplicate based on the user key. By default , the deduplication is run on the lastModified field and will only keep the latest records.
2>. If this is for targeting purposes , you can also use an Incremental query which only shows you changed , modified or latest records which were previously not processed
Regards,
Adhiyan