Mysql一些小技巧
update & select
UPDATE 表a
SET 表a.字段 = 表b.字段
FROM 表a INNER JOIN 表b ON 表b.字段 = 表a.字段
WHERE {CONDITION}
判断null与空
select w.SysNo , w.Name , isnull(w.CellPhone) , w.CellPhone
from worker w
where 1 = 1
and isnull(w.CellPhone)= 0
and length(trim(w.CellPhone))>0
;
插入时判重
insert into testmgt.s(name, c) select '一个名字', 123
from dual
WHERE NOT EXISTS (select *
from testmgt.s
where c = 123
努力到无能为力,拼搏到感动自己