您好我正在尝试运行此更新查询:
UPDATE Employee_Table
SET Employee_Table.First_Name =
(
SELECT
[Employee_Table].[Full_Name]
,LEFT([Full_Name], InStr([Full_Name], " ") - 1) AS First_Name
FROM [Employee_Table]
)
,Employee_Table.Last_Name =
(
SELECT
[Employee_Table].[Last_Name]
,mid([Full_Name], InStr([Full_Name], " ") + 1) AS Last_Name
FROM [Employee_Table]
)
WHERE (((Employee_Table.First_Name) IS NULL) AND ((Employee_Table.Last_Name) IS NULL));
但是,我收到一条消息,说明如下: “我编写了一个子查询,可以在不使用Exists Reserved字的情况下返回多个字段。”
我在访问中构建了查询,并将大部分SQL代码放在那里。
感谢您提供的任何帮助。
答案 0 :(得分:2)
我的猜测是你要从全名字段中提取名字和姓氏,并将它们存储在同一行。
UPDATE Employee_Table
SET
First_Name = Left(Full_Name, InStr(Full_Name, " ") - 1),
Last_Name = Mid(Full_Name, InStr(Full_Name, " ") + 1)
WHERE
First_Name Is Null
AND Last_Name Is Null;