Sorry, didn't mean to suggest I was going to delete the record. What I meant is "ignore the dups." Let's say these two records are in the result setYou are right. Not whole the records are duplicated, and many records in Important_0 are duplicated. I am not sure what do you mean by discard?![]()
Make sure you FULLY test. All code, including queries, is extremely subtle. Make absolutely sure it returns the correct set of results in all possible circumstances.Hello Jal! Thank you very much! It is fully working!!! Very nice work! Thank you!
You could do this in the first query but it gets pretty ugly.I have a question about one of the columns/fields. In the original file the column 'Detail0/2-Needed' is for storing some codes (like: S, C, L, EO_50VBC). But I would like that instead of these codes meaningfull words to be displayed (like: S stands for New partner, L stands for Old partner and so on).
This might be a better way, I'm not sure. I'll give it some thought.Perhaps the best way is to make another table where first field would contain the codes and the second field would containt the description of the codes.
SELECT Important_0, [Detail0/4-Needed], [Detail0/1-Needed], A.FullName as [Detail0/2-Needed]
FROM
(
SELECT Important_0, FIRST(D.[Detail0/4-Needed]) as [Detail0/4-Needed], FIRST(D.[Detail0/1-Needed]) as [Detail0/1-Needed], FIRST(D.[Detail0/2-Needed]) as [Detail0/2-Needed]
FROM [Database] as D
WHERE Important_2 = @NumberToFind
GROUP BY Important_0
UNION ALL
SELECT Important_0, FIRST(D.[Detail0/4-Needed]) as [Detail0/4-Needed], FIRST(D.[Detail0/1-Needed]) as [Detail0/1-Needed], FIRST(D.[Detail0/2-Needed]) as [Detail0/2-Needed]
FROM [Database] as D
WHERE Important_1 = @NumberToFind
GROUP BY Important_0
) as Connections
LEFT JOIN AbbreviationsForDetails02Needed as A
ON A.Abbreviation = Connections.[Detail0/2-Needed]
Yes, that's what I was working on. The idea was for you to type in these translations into the new Abbreviations table - I didn't you know had already stored them in an Excel file.In the original file the column 'Detail0/2-Needed' is for storing some codes (like: S, C, L, EO_50VBC). But I would like that instead of these codes meaningfull words to be displayed (like: S stands for New partner, L stands for Old partner and so on).