常用SQL

常用SQL

1.把某列值赋值给另一列

#把某列值赋值给另一列
UPDATE tb_departments SET department = dept_name;

2.把一个表中的某一列赋值到另一个表中的某一列

UPDATE Lab_Test_Master
SET Lab_Test_Master.id_number= Applied_Patient_Info.Identity_No,
Lab_Test_Master.Telephone = Applied_Patient_Info.Tel
FROM
    Applied_Patient_Info
WHERE
    Lab_Test_Master.YW_Test_No= Applied_Patient_Info.YW_Test_No
LICENSED UNDER CC BY-NC-SA 4.0