項目中可能回遇到or 與? and? 連用,我認為or連接的前后是兩個條件.所以不能一個條件分開寫.
比如 一張表a? 有 user_code,shared,del,company_id四個字段? 我想查shared=1 且 del=0 或者del=0的數(shù)據(jù) 且company_id=1, shared是共享的意思,不區(qū)分公司,那么可以這樣寫
例? select? user_code from a where shared=1? and del=0 or del=0
項目中可能回遇到or 與? and? 連用,我認為or連接的前后是兩個條件.所以不能一個條件分開寫.
比如 一張表a? 有 user_code,shared,del,company_id四個字段? 我想查shared=1 且 del=0 或者del=0的數(shù)據(jù) 且company_id=1, shared是共享的意思,不區(qū)分公司,那么可以這樣寫
例? select? user_code from a where shared=1? and del=0 or del=0