问题描述
我已经在Access中创建了一个查找表,以提供列的可能值.现在,我需要使用转换列之前的数据来更新此列.我无法弄清楚将运行的SQL查询.我不断收到错误消息"UPDATE或DELETE查询不能包含多值字段."我的研究表明,我只需要设置列的值,但这总是更新0条记录:
I have created a lookup table in Access to provide the possible values for a column. Now I need to update this column with the data it had before I converted the column. I am unable to figure out a SQL Query that will work. I keep getting the error "An UPDATE or DELETE query cannot contain a multi-valued field." My research has suggested that I just need to set the value of the column but this always updates 0 records:
UPDATE [table_name] SET [column_name].Value = 55 WHERE [table_name].ID = 16;
我知道如果更改查询以更新文本列,此查询将起作用,因此仅此列绝对是一个问题.
I know this query will work if I change it to update a text column, so it is definitely a problem with just this column.
推荐答案
如果要将值添加到多值字段中,请使用附加查询.
If you're adding a value to your multi-valued field, use an append query.
INSERT INTO table_name( [column_name].Value )
VALUES (55)
WHERE ID = 16;
如果要更改多值字段中存在的一个特定值,请使用UPDATE语句.例如,将55更改为56 ...
If you want to change one particular value which exists in your multi-valued field, use an UPDATE statement. For example, to change the 55 to 56 ...
UPDATE [table_name]
SET [column_name].Value = 56
WHERE [column_name].Value = 55 And ID = 16;
请参见在查询中使用多值字段以获取更多信息.
See Using multivalued fields in queries for more information.
这篇关于更新Access中的多值字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!