select count(*) from customer_infowhere custcd not in (select custcd from grade_model_info where custcd = '10000')在這條Sql語(yǔ)句中g(shù)rade_model_info這張表中事實(shí)上是沒(méi)有custcd這個(gè)字段的,但是這個(gè)sql語(yǔ)句不會(huì)報(bào)錯(cuò)。會(huì)正常執(zhí)行。但是把select custcd from grade_model_info where custcd = '10000'單獨(dú)執(zhí)行的話會(huì)報(bào)錯(cuò)。還有一點(diǎn)就是custcd = '10000'這個(gè)限定條件中的值如果在customer_info表中存在記錄,查詢結(jié)果會(huì)有影響
SQL中in和not in的問(wèn)題
qq_花開(kāi)花謝_0
2019-03-02 07:03:24