1

假设我有两张桌子,

Employee
name address phone phone_type

EmployeeContacts
name address phone

因此,我可以做类似的事情:

INSERT INTO Employee name, address, phone VALUES(SELECT name, address, phone from EmployeeContacts where name = "Joe") and phoneType = "mobile"

?

基本上,插入从一个表中选择的某些值并插入一个额外的值?

如果没有,我该怎么做?

4

1 回答 1

2

您想使用以下insert . . . select表格:

INSERT INTO Employee(name, address, phone, phonetype)
    SELECT name, address, phone, 'mobile'
    from EmployeeContacts
    where name = 'Joe'
于 2013-07-23T01:24:24.570 回答