通達OA

在user表中 部門ID此字段(DEPT_ID)標記爲0的即爲離職人員mysql


使用locate(substr,str)函數,若是包含,返回>0的數,不然返回0 

例子:判斷site表中的url是否包含'http://'子串,若是不包含則拼接在url字符串開頭
update site set url =concat('http://',url) where locate('http://',url)=0 

注意mysql中字符串的拼接不能使用加號+,用concat函數 sql

相關文章
相關標籤/搜索