gpt4 book ai didi

mysql - sql测试条件如果失败转移到下一个人

转载 作者:行者123 更新时间:2023-11-29 18:07:50 24 4
gpt4 key购买 nike

我正在尝试获取没有 status_mvf = 88 的骨灰盒

status_mvf    urn        desc        date
88 104 no show 2017-03-06
9 104 late 2017-03-07
2 104 on time 2017-03-08
2 210 on time 2017-03-06
2 210 on time 2017-03-07
9 320 late 2017-03-06

SELECT
a.Status_Mvf,
p.URN,
v.ADMIT_DATE


FROM APPOINTMENT
WHERE Status_Mvf <> '88'

--group by p.urn,

ORDER BY URN, STATUS_MVF

期望的结果 - 没有 104 瓮,因为它有 88

status_mvf   urn       desc      date
2 210 on time 2017-03-06
2 210 on time 2017-03-07
9 320 late 2017-03-06

最佳答案

您可以使用不存在:

select a.*
from appointment a
where not exists (select 1 from appointment a2 where a2.urn = a.urn and a2.status_mvf = '88');

关于mysql - sql测试条件如果失败转移到下一个人,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47678329/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com