删除冗余接入领域细胞 [英] Remove redundant Access field cells

查看:179
本文介绍了删除冗余接入领域细胞的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是持续的 结合接入领域到一个场给出两个查询

我下表中的三个主要领域 Name_2010 Name_2011 Name_2012 ,他们需要被整合为 Name_Final

我用下面的查询来选择每行三个字段的仅一个特定成员,但目前其作为打算作为它不能识别冗余单元不工作。

  SELECT
  IIF(Name_2010在(Name_2011,Name_2012),'',Name_2010)
  为N1,
  IIF(Name_2011在(Name_2010,Name_2012),'',Name_2011)
  AS N2,
  IIF(Name_2012在(Name_2010,Name_2011),'',Name_2012)
  视N3
  从表1;
 

我应该使用什么样的查询来实现 Name_Final 鉴于我目前的表?

解决方案

  SELECT ID,N1和放大器;
  IIF(N 2&其中;> N1,N2,'')及
  IIF((N&其中;> N 2)和(N 3&其中;> N1),N 3,'')的AS Name_Final
从
  (SELECT ID,新西兰(Name_2010)为N1,NZ(Name_2011)AS N2,NZ(Name_2012)视N3
   从表1)AS T
ORDER BY ID;
 

ORDER BY 子句是说话算数的,而不是作为Name_Final计算的一部分。

Continued from Combine Access fields into one field given two queries

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;

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;

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

这篇关于删除冗余接入领域细胞的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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