- 把某个表的某些字段赋值到新建表指定字段中,具体SQL如下:
INSERT INTO sn_survey_task_dispatch_casepoint_info
(task_no, case_point_no,case_point_type,case_point_name,
investigator,is_effective_point,province,city,district)
(SELECT taskno, casepointdetno , casepoint, casepointdet ,investigator,
effectivepointflag , province,city,district
FROM sn_survey_task_dispatch_casepointdet WHERE taskno = 'DT202105215636');
- 把一个表的字段更新另一个表的字段
update table1 set
field1=table2.field1,
field2=table2.field2
from table2
where table1.id=table2.id