Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我在查询中添加 where 条件,它会给我过滤结果。但我需要的是一个结果,其中所有行(过滤+未过滤)都显示有一个附加(虚拟)列,它通过某种方式(比如布尔值)告诉我特定行满足“where条件”。
以示例where条件为例:
where
where col1 = 2
使用 acase添加额外的列,指示是否满足条件:
case
select *, case when col1 = 2 then 'true' else 'false' end as `dummy` from your_table