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!

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]

Is it that simple? Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.