I have the following table:
CampaignID AccountNumber
1................ 1
1................ 3
1................ 7
2................ 2
2................ 3
2................ 7
3................ 1
3................ 3
3................ 7
The Account must exist for all 3 campaigns, in the above example, accounts 3 and 7 qualify only. This is what I've come up with, but I get a syntax error.
SELECT
c1.AccountNumber, c2.AccountNumber, c3.AccountNumber
FROM
uCampaign as c1
WHERE
c1.CampaignID = '1'
INNER JOIN
uCampaign as c2
ON
c1.AccountNumber = c2.AccountNumber
INNER JOIN
uCampaign as c3
WHERE
c2.CampaignID = '2'
ON
c1.AccountNumber = c3.AccountNumber
WHERE
c3.CampaignID = '3'
Thanks.
Rick
CampaignID AccountNumber
1................ 1
1................ 3
1................ 7
2................ 2
2................ 3
2................ 7
3................ 1
3................ 3
3................ 7
The Account must exist for all 3 campaigns, in the above example, accounts 3 and 7 qualify only. This is what I've come up with, but I get a syntax error.
SELECT
c1.AccountNumber, c2.AccountNumber, c3.AccountNumber
FROM
uCampaign as c1
WHERE
c1.CampaignID = '1'
INNER JOIN
uCampaign as c2
ON
c1.AccountNumber = c2.AccountNumber
INNER JOIN
uCampaign as c3
WHERE
c2.CampaignID = '2'
ON
c1.AccountNumber = c3.AccountNumber
WHERE
c3.CampaignID = '3'
Thanks.
Rick