update lims_ordtask lo
set lo.cnas = '1'
where exists (select 1
from lims_folders f
where lo.foldersid = f.foldersid
and f.folderno in ('NJ2020MS0095',
'NJ2020MS0094',
'NJ2020MS0093',
'NJ2020MS0092',
'NJ2020MS0091',
'NJ2020MS0090',
'NJ2020MS0089')
and (lo.testno = '色澤' or lo.testno = '滋味、氣味' or
lo.testno = '組織狀態' or lo.testno = '凈含量'))
有兩個表:student & city,現在需要取出 city.name 來更新 student.city_name。兩表關聯條件是 student.city_code=city.code。
update student s, city c
set s.city_name = c.name
where s.city_code = c.code;
也可以試下面的相關子查詢:
update student s set city_name = (select name from city where code = s.city_code);
————————————————
版權聲明:本文為CSDN博主「宋發元」的原創文章,遵循CC 4.0 BY-SA版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/u011019141/article/details/80045096
mysql更新字段為“”或 null
//更新為""串
update taxi_driver_info set wechat = '' where driverno = '0440923198101075636'; //更新為null update taxi_driver_info set wechat = null where driverno = '0440923198101075636';