如何按大小寫篩選?T-Sql如何按大小寫篩選
select * from address
where streetnum > 1000 only when state = MI otherwise select everything else
或
select * from address
where case when state = MI then streetnum > 1000
如何按大小寫篩選?T-Sql如何按大小寫篩選
select * from address
where streetnum > 1000 only when state = MI otherwise select everything else
或
select * from address
where case when state = MI then streetnum > 1000
如果我理解你的問題正確,然後...
select * from address
where state <> 'MI' or (state = 'MI' and streetnum > 1000)
從address
,獲取所有行,但是當state
是'MI'
然後streetnum
必須比1000
更大。
select * from address
where streetnum > 1000 or state <> 'MI'
如果你想使用case
你可能有多個值來檢查。
select *
from address
where case state
when 'MI' then 1000
when 'MA' then 1000
else 0
end < streetnum
而且,如果您對所有狀態具有相同的值(1000),那麼這將與此相同。
select *
from address
where streetnum > 1000 or state not in ('MI', 'MA')
加上一個正確解釋的問題。 –
仇敵會討厭LOL –