mysql 判断null 用isnull(companyType)

update bt_help set companyName = '南通纵横塑胶有限公司',creditCode = '91854400MA62564300',createUserID = '75751227-a50b-452e-a75f-200705f0ab4a',createUserName = 'test10',companyType = '3',
commitUserId='75751227-a50b-452e-a75f-200705f0ab4a',CommitUserName = 'test10' where creditCode='信用代码2'

select  * from bt_help where isnull(companyType)

 SELECT CREDITCODE,upper(substring_index(CREDITCODE,'-',1)) AS AAA, contat('',upper(substring_index(CREDITCODE,'-',1))) as BBB
FROM sys_company where CREDITCODE like '%-%';


 SELECT CREDITCODE,upper(substring_index(CREDITCODE,'-',1)) AS AAA  , concat('91854400MA',upper(substring_index(CREDITCODE,'-',1))) as BBB
FROM sys_company where CREDITCODE like '%-%';


update sys_company set CREDITCODE =  concat('91854400MA',upper(substring_index(CREDITCODE,'-',1)))  where CREDITCODE like '%-%';



update bt_help set companyName = '南通市交通钢绳有限责任公司',creditCode = '91512081MA62086543',createUserID = 'db58d170-1246-483c-926c-5255b2201286',createUserName = 'test01',companyType = '1',
commitUserId='db58d170-1246-483c-926c-5255b2201286',CommitUserName = 'test01' where id in 
('5d937691-404b-4969-831c-8d65048994a1','342196a2-1218-4282-aa1a-3adfb0f66b6e','e1546b5a-c213-4bc7-a002-1c403e3a785d','f787a5fb-1486-4900-afa4-f089263b80e6')
------------------------- A little Progress a day makes you a big success... ----------------------------
原文地址:https://www.cnblogs.com/qianjinyan/p/14307770.html