亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

SQL中in和not in的問題

SQL中in和not in的問題

qq_花開花謝_0 2019-03-02 07:03:24
select count(*) from customer_infowhere custcd not in (select custcd from grade_model_info where custcd = '10000')在這條Sql語句中grade_model_info這張表中事實上是沒有custcd這個字段的,但是這個sql語句不會報錯。會正常執行。但是把select custcd from grade_model_info where custcd = '10000'單獨執行的話會報錯。還有一點就是custcd = '10000'這個限定條件中的值如果在customer_info表中存在記錄,查詢結果會有影響
查看完整描述

2 回答

?
手掌心

TA貢獻1942條經驗 獲得超3個贊

整條語句 執行的話 “select custcd from grade_model_info where custcd = '10000'” 它 只是作為 “select count(*) from customer_info” 的條件存在 只會返回結果 為false或者空 所以 查詢 不受影響 !

查看完整回答
反對 回復 2019-03-09
  • 2 回答
  • 0 關注
  • 679 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

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

公眾號

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