There is a relationship relations table, in which employees' IDs are stored, time stamps when they interacted and a parameter that shows whether this relationship is displayed or not. You need to be able to get all the latest outgoing connections from one user to other unique users.
Now the first request pulls out the first user contacts from the database, the second request - all contacts are arranged in time from the freshest to the oldest. It is necessary to get only a list of the most recent user contacts.
I read about the placement in the ORDER BY subquery, and in the outer GROUP BY, but this bundle leaves the oldest connection between users, and not the most recent one.
select *from group by cannot be, because * returns all columns of source records, and after group by no source lines remain in principle ru.stackoverflow.com/q/599772/194569 - Mike