I have a query using a Union to combine two Queries. In the Query editor I run into no errors but when I click finish, I get the error Cannot find table 0. So syntax errors show up so I am lost.
Here is my query
-- Query 1: Contact_Salesforce
SELECT
D.Email AS EmailAddress,
D.Id AS Id,
D.FirstName AS FirstName,
D.LastName AS LastName
FROM
Contact_Salesforce D
WHERE
D.Spotlight__c = 1
AND D.Email IS NOT NULL
AND D.Email != ''
UNION
-- Query 2: CampaignMember_Salesforce
SELECT
G.Email AS EmailAddress,
G.LeadOrContactId AS Id,
NULL AS FirstName, -- Ensure columns match with Query 1
NULL AS LastName -- Ensure columns match with Query 1
FROM
CampaignMember_Salesforce G
WHERE
G.Email IS NOT NULL
AND G.Email != ''
AND G.LeadOrContactId IS NOT NULL
AND G.LeadOrContactId != ''