ForeverSmiYngEcologyKit/连表查询某个树形在哪些流程引用.sql
wintsa 70376e6c47 添加 连表查询某个树形在哪些流程引用.sql
Signed-off-by: wintsa <wintsa123@gmail.com>
2025-09-09 15:52:42 +08:00

16 lines
480 B
SQL
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

SELECT
wb.tablename, -- 表单表名
wf.workflowname, -- 流程名称
wf.id AS workflowid, -- 流程ID取最新版本
a.* -- 字段信息
FROM workflow_billfield a
JOIN workflow_bill wb
ON a.billid = wb.id
left JOIN workflow_base wf
ON wf.formid = wb.id
WHERE a.fielddbtype = '57504' -- 树形的id
AND wf.id = (
SELECT MAX(id)
FROM workflow_base wf2
WHERE wf2.workflowname = wf.workflowname
);