I'm trying to list 8 users (name and profile image) starting with the one who created the newest node and follow with the rest of users in (descending) order of their last created node.
I got to achieve it* by:
- adding fields and filters
- adding a Relationship (advanced) with Content authored
- adding Sort criteria as Content: date (descendant)
It 'works' but I get duplicated users. If a user created the 3 newest nodes, then it appears in positions #1, #2 and #3. I can't get it to get only distinct (unique) users in the list. Aggregation did not work.
SQL query (where I get users in the right order but with repeated ones) added:
SELECT DISTINCT "users_field_data"."created" AS "users_field_data_created", "users_field_data"."uid" AS "uid", "node_field_data_users_field_data"."nid" AS "node_field_data_users_field_data_nid", DATE_FORMAT((DATE_ADD('19700101', INTERVAL node_field_data_users_field_data.created SECOND) + INTERVAL 3600 SECOND), '%Y%m%d%H') AS "node_field_data_users_field_data_created_hour"
FROM
{users_field_data} "users_field_data"
INNER JOIN {node_field_data} "node_field_data_users_field_data" ON users_field_data.uid = node_field_data_users_field_data.uid
LEFT JOIN {user__roles} "user__roles_value_0" ON users_field_data.uid = user__roles_value_0.entity_id AND user__roles_value_0.roles_target_id = 'content_editor'
WHERE ("users_field_data"."status" = '1') AND ("user__roles_value_0"."roles_target_id" = 'content_editor')
ORDER BY "node_field_data_users_field_data_created_hour" DESC, "users_field_data_created" DESC
LIMIT 10 OFFSET 0
Any clues? Ty