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.
来源:https://stackoverflow.com/questions/19334208/remove-redundant-access-field-cells