0

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 != ''

1 Answer 1

0

I resolved the issue. It didn't like my use of comments in the query. All Good now!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .