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.
在我的数据库中,1 代表真,0 代表假。在我的专栏中,现在我想知道是否有人可以帮助我编写一个查询,如果值等于 1,则输出为 true,如果等于 0,则显示为 false?。
尝试使用case
case
select case when col = 1 then 'true' when col = 0 then 'false' else 'NN' end as val
select case when your_bool_column = 1 then 'true' else 'false' end as bool_col from your_table