第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

sql語句怎么實現(xiàn)動態(tài)條件

sql語句怎么實現(xiàn)動態(tài)條件

MMTTMM 2018-07-24 10:13:12
select * from T where operator = (case when @type = 0 then @o1 else is not null end) 主要是想根據@type 用不同的條件當@type = 0 時 operator = @o 否則 operator is not null 請問各位大俠SQL語句怎么寫,最好不要用字符串拼接
查看完整描述

3 回答

?
MMMHUHU

TA貢獻1834條經驗 獲得超8個贊

select * from T where (operator = @o1 and @type = 0 ) or ( @type <> 0 and operator is not null )

查看完整回答
反對 回復 2018-07-26
?
湖上湖

TA貢獻2003條經驗 獲得超2個贊

定義一個臨時變量,然后用if else去判斷,然后把值放到sql語句里面執(zhí)行

查看完整回答
反對 回復 2018-07-26
?
元芳怎么了

TA貢獻1798條經驗 獲得超7個贊

(case when @type=0 then (case when operator=@o then 1 else 0 end) else (case when operator is not null then 1 else 0 end) end )=1

查看完整回答
反對 回復 2018-07-26
  • 3 回答
  • 0 關注
  • 2777 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號