select count(*)
from change_record cr
where 1 = 1
and cr.change_status_id = 29
and cr.testers = 'yhl'
and (case cr.change_record_res_id when 1 then
(select bug.bug_status_id
from bug_record bug
where bug.bug_id = cr.origin_source_id) when 2 then
(select req.req_status_id
from requirement_record req
where req.req_id = cr.origin_source_id) else 0 end) in (4, 24)
sql: where 中 case
最新推荐文章于 2024-12-12 21:19:08 发布
本文提供了一个具体的SQL查询案例,展示了如何使用复杂的条件筛选和关联查询来获取特定的数据记录。该查询涉及多个表之间的关联,并通过case when结构实现了灵活的条件判断。
615

被折叠的 条评论
为什么被折叠?



