5
我想執行的查詢中,結果我有柱與假,如果在前者列中的值是0,true,如果是大於0:選擇真,如果更多的則0在T-SQL
爲例如:
id count
1 1
2 3
3 0
4 5
5 2
結果:
id count
1 true
2 true
3 false
4 true
5 true
我想執行的查詢中,結果我有柱與假,如果在前者列中的值是0,true,如果是大於0:選擇真,如果更多的則0在T-SQL
爲例如:
id count
1 1
2 3
3 0
4 5
5 2
結果:
id count
1 true
2 true
3 false
4 true
5 true
select
id,
case
when count > 0 then 'true'
else 'false'
end as count
from myTable
select id
, case when count > 0 then cast(1 as bit) else cast(0 as bit) end as count
from myTable
它不能解決闕正如所問,但在我看來,更好的方式來處理真/假+1 –