0

Why am I getting this error?

An error occurred while checking the query syntax. Errors: Invalid column name 'Id'.

SELECT
    (L.Id) as 'SubscriberKey',
    L.ID__c as 'ID_C',
    L.Email as 'EmailAddr',
    L.Gender__c as 'Gender',
    L.Count_ID as 'Count_ID'

    from (
        select 
        (T.Id) as 'SubscriberKey',
        T.ID__c as 'ID_C',
        T.Email as 'EmailAddr',
        T.Gender__c as 'Gender',
        row_number() over (order by T.CreatedDate desc) as 'Count_ID'

        from ent.Lead_Salesforce T

        WHERE 
        T.Email <> ''
        and T.Email is not null
        and (T.ID__c<>' ' or T.ID__c Is NOT Null) 
    ) L

I'm trying to imitate AUTO_INCREMENT using row_number()

1 Answer 1

0

Needed to remove as '<rename>' from the second select. Otherwise, the first select cannot find this column names.

You must log in to answer this question.

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