infinitizon
MIS
Hi guys,
I have a table named 'tbl_slo_approver_users' that looks like this
id | type | sequence | delegate_level | user_name | email | delegated
1 | SLO | 1 | 0 | aaa | aaa@gmail.com | 0
2 | SLO | 2 | 0 | bbb | bbb@gmail.com | 0
3 | SLO | 3 | 0 | ccc | ccc@gmail.com | 0
4 | SLO | 1 | 1 | ddd | ddd@gmail.com | 0
5 | SLO | 1 | 2 | eee | eee@gmail.com | 0
6 | GRD | 1 | 0 | fff | fff@gmail.com | 0
....
This table is a table showing people that can approve different types of request (SLO, GRD, etc)
What I want to achieve is such that by default, the person with sequence 1 should be the person to approve a request. However, there is a possibility of him delegating the resposibility to his subordinate; thereby, delegated should be 1 allowing for the subordinate to be able to approve.
Thus, suppose SLO is the stuff to be approved, then the person to approve by default is aaa. If aaa is absent, then, delegated should be 1 so that ddd (who is on thesame sequence of 1 for SLO) will be able to approve. If ddd is absent, then his own delegated also should be 1 allowing for eee (who is also in thesame sequence of 1 for SLO) to be able to approve.
What I want now is a query that will pull the record for eee (assuming aaa and ddd have a delegated of 1).
I hope I've been able to explain my situation
I have a table named 'tbl_slo_approver_users' that looks like this
id | type | sequence | delegate_level | user_name | email | delegated
1 | SLO | 1 | 0 | aaa | aaa@gmail.com | 0
2 | SLO | 2 | 0 | bbb | bbb@gmail.com | 0
3 | SLO | 3 | 0 | ccc | ccc@gmail.com | 0
4 | SLO | 1 | 1 | ddd | ddd@gmail.com | 0
5 | SLO | 1 | 2 | eee | eee@gmail.com | 0
6 | GRD | 1 | 0 | fff | fff@gmail.com | 0
....
This table is a table showing people that can approve different types of request (SLO, GRD, etc)
What I want to achieve is such that by default, the person with sequence 1 should be the person to approve a request. However, there is a possibility of him delegating the resposibility to his subordinate; thereby, delegated should be 1 allowing for the subordinate to be able to approve.
Thus, suppose SLO is the stuff to be approved, then the person to approve by default is aaa. If aaa is absent, then, delegated should be 1 so that ddd (who is on thesame sequence of 1 for SLO) will be able to approve. If ddd is absent, then his own delegated also should be 1 allowing for eee (who is also in thesame sequence of 1 for SLO) to be able to approve.
What I want now is a query that will pull the record for eee (assuming aaa and ddd have a delegated of 1).
I hope I've been able to explain my situation