作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我是一个新的阅读存储过程。
我在想这是否可以在 mysql 的存储过程中完成。
我有称为步骤的批准流程序列。批准的专栏; 1 表示是 0 表示否。
基本上我的批准顺序中有步骤 1 到 3。如果第 1 步批准状态为 0,他将是第一个批准或查看该表的人。如果步骤 1 批准为 1。步骤 2 现在可以看到该表。
交易步骤表:
id transaction_id approver_id step approved
1 1 1 1 1
2 1 2 2 0
3 1 3 3 0
4 2 3 1 1
5 2 1 2 1
6 2 2 3 0
7 3 2 1 0
8 3 3 2 0
9 3 1 3 0
10 4 1 1 1
11 4 3 2 0
12 4 2 3 0
示例,如果我的批准 ID = 2
在我看来:我只能看到所有接下来的批准
id transaction_id approver_id step approved
2 1 2 2 0
6 2 2 3 0
7 3 2 1 0
请告诉我这是否可行。谢谢
最佳答案
如果我理解正确的话,您希望每笔交易的行都是第一个未批准的行并且批准者是 2。
试试这个:
select ts.*
from transactionsteps ts join
(select transaction_id, min(step) as minstep
from transactionsteps
where approved = 0
group by transaction_id
) t
on ts.transaction_id = t.transaction_id and
ts.step = t.minstep
where approver_id = 2;
关于MYSQL存储过程、审批和审批人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27220966/
只是一个简短的问题。为了节省时间,我们计划只创建一个打开浏览器并指向我们网站的应用程序。后续更新将提供其余功能。 根据您的经验,此应用会获得批准吗?如果不是,我需要做什么才能获得批准? 干杯,RJ 最
我是一名优秀的程序员,十分优秀!