私はいくつかの提案を読みましたが、ビューによって生成および表示されるクエリを作成する方法を理解できませんでした-mysqlで有効です。{}で閉じられた変数がいくつかあります。また、クエリにはDBに存在しないテーブルがいくつかあると思います。ここに非常に複雑なクエリを抽出しようとしています。事前に10倍!
SELECT field_data_field_punch_status.field_punch_status_value AS field_data_field_punch_status_field_punch_status_value, users.name AS users_name, users.uid AS uid_1, field_data_field_punch_start.field_punch_start_value AS field_data_field_punch_start_field_punch_start_value, field_data_field_team.field_team_tid AS field_data_field_team_field_team_tid, users.access AS users_access, MIN(users.uid) AS uid, 'user' AS field_data_field_punch_status_user_entity_type, 'user' AS field_data_field_punch_start_user_entity_type, MIN(node_users.nid) AS node_users_nid, 'node' AS field_data_field_punch_end_node_entity_type, MAX(node_users__field_data_field_punch_end.field_punch_end_value) AS node_users__field_data_field_punch_end_field_punch_end_value, 'user' AS field_data_field_team_user_entity_type
FROM
{users} users
LEFT JOIN {field_data_field_team} field_data_field_team ON users.uid = field_data_field_team.entity_id AND (field_data_field_team.entity_type = 'user' AND field_data_field_team.deleted = '0')
INNER JOIN {taxonomy_term_data} taxonomy_term_data_field_data_field_team ON field_data_field_team.field_team_tid = taxonomy_term_data_field_data_field_team.tid
LEFT JOIN {node} node_users ON users.uid = node_users.uid
INNER JOIN {users_roles} users_roles ON users.uid = users_roles.uid
LEFT JOIN {field_data_field_punch_status} field_data_field_punch_status ON users.uid = field_data_field_punch_status.entity_id AND (field_data_field_punch_status.entity_type = 'user' AND field_data_field_punch_status.deleted = '0')
LEFT JOIN {field_data_field_punch_start} field_data_field_punch_start ON users.uid = field_data_field_punch_start.entity_id AND (field_data_field_punch_start.entity_type = 'user' AND field_data_field_punch_start.deleted = '0')
LEFT JOIN {field_data_field_punch_end} node_users__field_data_field_punch_end ON node_users.nid = node_users__field_data_field_punch_end.entity_id AND (node_users__field_data_field_punch_end.entity_type = 'node' AND node_users__field_data_field_punch_end.deleted = '0')
WHERE (( (field_data_field_team.field_team_tid IN('0', '10', '11', '22', '12', '2', '21', '3', '13', '4', '14', '5', '15', '6', '16', '7', '17', '18', '20', '19') ) AND (users_roles.rid IN ('4', '5')) ))
GROUP BY field_data_field_punch_status_field_punch_status_value, users_name, uid_1, field_data_field_punch_start_field_punch_start_value, field_data_field_team_field_team_tid, users_access
ORDER BY field_data_field_punch_start_field_punch_start_value DESC, users_access DESC