We Have a table of approval like below:
In above table we have ApprovalId
and ApprovalLevel
like first level approval and second level approval in ApprovalLevel
(For Approving Approval by its level). I am trying to fetch record in query if specific user ApprovalLevel >= 1
then check its previous ApprovalStatus
if it Approved then show its record too.
I have tried many things but still not getting specify record.
In Simple term select record with User if only if its ApprovalLevel=1
or its previous ApprovalLevel
ApprovalStatus=1
.
Please help me on this: [IN this table ApprovalStatus: 0 = Pending and 1:Approved]
I believe this is what you are requesting:
SELECT
ApprovalStatus,
ApprovalLevel,
CreatedOn
FROM
approval
WHERE
ApprovalLevel = 1
OR (ApprovalLevel > 1 AND ApprovalStatus = 1)
;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.