select FLOW_COMMON.c_task_id as taskId, FLOW_COMMON.c_owner as `owner` from template_flow_common FLOW_COMMON force index (template_flow_common_c_create_time_IDX) right join template_hollycrm1680160914000 hollycrm1680160914000 on FLOW_COMMON.c_business_id = hollycrm1680160914000.c_business_id where FLOW_COMMON.tenant_id = 'T000' and FLOW_COMMON.valid = 1 and lower(FLOW_COMMON.c_state) != 'draft' and lower(FLOW_COMMON.c_state) != 'end' and (((FLOW_COMMON.c_flow_id in ('FLOW20230330152148238756') and FLOW_COMMON.c_processing_group in ('1650685461842100265', '1654482883680665633') or FLOW_COMMON.c_cur_assignee = '1642716546558066731' ) and FLOW_COMMON.c_task_id in ( select id_ taskId from ACT_RU_TASK where ASSIGNEE_ = '1642716546558066731' and ASSIGNEE_ is not null union select c_task_id as taskId from template_flow_common) or FLOW_COMMON.c_processing_group in ('1650685461842100265', '1654482883680665633') )) and FLOW_COMMON.c_workorder_type = 'C0018' and FLOW_COMMON.c_business_type = 'C00180008,C001800080001,C0018000800010001' order by FLOW_COMMON.c_create_time desc, FLOW_COMMON.c_urgency desc limit 572550,10
时间: 2023-10-15 14:08:19 浏览: 124
progress_demo.zip
这是一个复杂的 SQL 查询语句,根据一些条件从数据库中选择数据并进行排序和分页。这个查询语句的目的是从表 template_flow_common 中获取一些特定的列,与表 template_hollycrm1680160914000 进行右连接,并根据一些条件进行过滤和排序。
查询中的条件包括:
- FLOW_COMMON.tenant_id = 'T000' and FLOW_COMMON.valid = 1:租户ID为'T000'且有效。
- lower(FLOW_COMMON.c_state) != 'draft' and lower(FLOW_COMMON.c_state) != 'end':状态不是'draft'和'end'。
- FLOW_COMMON.c_flow_id in ('FLOW20230330152148238756'):流程ID在给定的列表中。
- FLOW_COMMON.c_processing_group in ('1650685461842100265', '1654482883680665633') or FLOW_COMMON.c_cur_assignee = '1642716546558066731':处理组在给定的列表中或当前受理人为指定的值。
- FLOW_COMMON.c_task_id in (select id_ taskId from ACT_RU_TASK where ASSIGNEE_ = '1642716546558066731' and ASSIGNEE_ is not null union select c_task_id as taskId from template_flow_common):任务ID在子查询的结果集中。
- FLOW_COMMON.c_workorder_type = 'C0018':工单类型为'C0018'。
- FLOW_COMMON.c_business_type = 'C00180008,C001800080001,C0018000800010001':业务类型在给定的列表中。
最后,结果按照 FLOW_COMMON.c_create_time 和 FLOW_COMMON.c_urgency 进行降序排序,并限制返回的结果为第 572,550 条开始的 10 条记录。
阅读全文