我正在尝试在MS Access中运行查询(使用符合ANSI 92 / T-SQL的语法选项) (我希望)将删除我的表中的重复值,这些值由Branch Rep ID复制。此查询的最终目标是留下每个都具有唯一分支代表ID的记录,这反过来意味着我的表中的每个重新分配都是唯一的,因为分支代表ID是唯一的重复字段。
我在MS Access中获取典型的弹出框要求我定义列值,因为它无法识别我输入的列值。我已经仔细检查过所有的列名,然后它们都拼写/间隔/括号[]正确(据我所知)
我被困住了,肯定可以使用一些帮助。
以下是该问题的屏幕截图:
此外,这是我坚持的实际代码:
DELETE DTP_ALL_ALIASES.*
FROM DTP_ALL_ALIASES
LEFT OUTER JOIN
(
SELECT min([branch rep id]) as RowID, [CRD number], [Name First], [Name Last] , Dealer, [Dealer Name], Dealerbrch, [Phone Office Nbr], [Phone Fax Nbr], [Email Address], [Primary Addr Type],
[Primary Address 1], [Primary Address 2], [Primary Branch], [Primary City], [Primary St], Cntry, [Primary Zip]
FROM DTP_ALL_ALIASES AS dtp
Group by [CRD number], [Name First], [Name Last] , Dealer, [Dealer Name], Dealerbrch, [Phone Office Nbr], [Phone Fax Nbr], [Email Address], [Primary Addr Type],
[Primary Address 1], [Primary Address 2], [Primary Branch], [Primary City], [Primary St], Cntry, [Primary Zip]
)
as KeepRows ON
DTP_ALL_ALIASES.[branch rep id] = KeepRows.RowId
WHERE
KeepRows.RowId IS NULL
编辑:我认为T-SQL标记在这里是合适的,因为此Access DB使用SQL Server兼容语法(ANSI 92)选项。