删除冗余访问字段单元格 [英] Remove redundant Access field cells

查看:148
本文介绍了删除冗余访问字段单元格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在两个查询之间将访问字段合并到一个字段

Continued from Combine Access fields into one field given two queries

我有下面的三个主要字段 Name_2010 Name_2011 code> Name_2012 ,他们需要集成为 Name_Final

I have the table below with three main fields Name_2010, Name_2011 and Name_2012 and they need to be integrated as Name_Final.

我使用下面的查询仅选择

I used the query below to select only a particular member of the three fields per row but currently it does not work as intended as it does not recognize redundant cells.

SELECT
  IIf(Name_2010 In (Name_2011, Name_2012), '', Name_2010) 
  AS N1,
  IIf(Name_2011 In (Name_2010, Name_2012), '', Name_2011) 
  AS N2,
  IIf(Name_2012 In (Name_2010, Name_2011), '', Name_2012) 
  AS N3
  FROM Table1;

我应该使用什么查询来实现 Name_Final 给我的当前表?

What query should I use to achieve Name_Final given my current table?

推荐答案

SELECT ID, N1 &
  IIf(N2 <> N1, N2, '') &
  IIf((N3 <> N2) And (N3 <> N1), N3, '') AS Name_Final
FROM
  (SELECT ID, Nz(Name_2010) AS N1, Nz(Name_2011) AS N2, Nz(Name_2012) AS N3
   FROM Table1) AS T
ORDER BY ID;

ORDER BY 说,而不是Name_Final计算的一部分。

The ORDER BY clause is for what it says, rather than being a part of the 'Name_Final' calculation.

这篇关于删除冗余访问字段单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆