我正在通过以下方式将数据从PharmacyData复制到fl_admin:

INSERT INTO fl_admin (first_name, last_name, email)
    SELECT ContactFirstName, ContactLastName, ContactEmail FROM PharmacyData


同时,我想用值“ pharmacy”填充fl_admin中名为“ type”的另一列。如何在同一SQL语句中执行此操作?

最佳答案

INSERT INTO fl_admin (type, first_name, last_name, email)
    SELECT 'pharmacy', ContactFirstName, ContactLastName, ContactEmail FROM PharmacyData

09-04 10:51