0

Hello guys,

I have two tables with the following structure:

TABLE A:
Email Address, CampaignID, Source, Unsubscribe
Email1,2
Email1,1
Email1,3
Email2,5

TABLE B:
Email Address, SeedList, ListName
Email1,SeedListA.SeedListA
Email1,SeedListB,SeedListB
Email2,SeedListC,SeedListC

The purpose is to merge the two tables together. But there is a really strange rationale behind this merge. If there are records of an Email Address in Table A, for instance 3 records, then for each and every record in Table A, I have to iterate all the records with the same Email Address from Table B.

Example:

MERGE TABLE:
Email Address, CampaignID, Source, Unsubscribe, SeedList, ListName
Email1 | 2 | 5 | yes | SeedList A | Seed List A
Email1 | 2 | 5 | yes | SeedList B | Seed List B
Email1 | 1 | 5 | yes | SeedList A | Seed List A
Email1 | 1 | 5 | yes | SeedList B | Seed List B
Email1 | 3 | 5 | yes | SeedList A | Seed List A
Email1 | 3 | 5 | yes | SeedList B | Seed List B
Email2 | 5 | 5 | yes | SeedList C | Seed List C

Does it make any sense?

Any assistance will be highly appreciated guys! Thanks a lot!

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by ETbo
0

SELECT a.[Email Address], a.CompaignID, a.Source, a.Unsubscribe, b.SeedList, b.ListName from TableA a, TableB b
WHERE a.[Email Address] = b.[Email Address]
ORDER BY a.[Email Address]

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.