1

您好我正在尝试运行此更新查询:

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 字的情况下返回多个字段。”

我在 access 中构建了查询,并将大部分 SQL 代码放在那里。

感谢您的任何帮助,您可以提供。

4

1 回答 1

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;
于 2013-08-09T06:20:04.423 回答