double2022 2017-08-29 18:03
浏览 23

多用户的批准和拒绝

We Have a table of approval like below:

Sql table

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]

  • 写回答

1条回答 默认 最新

  • doujiu9307 2017-08-29 19:00
    关注

    I believe this is what you are requesting:

    SELECT
        ApprovalStatus,
        ApprovalLevel,
        CreatedOn
    FROM
        approval
    WHERE
        ApprovalLevel = 1
        OR (ApprovalLevel > 1 AND ApprovalStatus = 1)
    ;
    
    评论

报告相同问题?

悬赏问题

  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
  • ¥15 Oracle中如何从clob类型截取特定字符串后面的字符
  • ¥15 想通过pywinauto自动电机应用程序按钮,但是找不到应用程序按钮信息
  • ¥15 如何在炒股软件中,爬到我想看的日k线
  • ¥15 seatunnel 怎么配置Elasticsearch
  • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
  • ¥15 (标签-MATLAB|关键词-多址)
  • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
  • ¥500 52810做蓝牙接受端