0

I am writing a Query where I want to select subscribers from a list wit the values that are added through a form, however I get the following error: "An error occurred while checking the query syntax. Errors: Error while processing square brackets"

This is the Query:

Select
l.EmailAddress,
l.First_Name,
l.Last_Name,
l.Company,
l.Phone,
l.userIp,
l.disclaimerTerms,
l.timeStamp,
from [_ListSubscribers] l
where ListName = ‘Whitepaper_Download_Test'

I am not sure what I am doing wrong here. Does anyone know how to fix the error?

3
  • On top of syntax issues, the _ListSubscribers data view doesn't hold profile attributes. So none of those fields with the exception of EmailAddress are valid. You will need to join with the _EnterpriseAttribute data view and pull the fields from there Jul 4, 2018 at 18:21
  • Hi @AnonWonderer, thanks for your suggestion. Do you have a recommendation on how to write this Query? Jul 4, 2018 at 18:44
  • Hey Daan - this thread should help: salesforce.stackexchange.com/questions/159582/… Jul 4, 2018 at 18:58

2 Answers 2

1

You had a ',' character after last column (l.timeStamp - it needs to be removed). I only use square brackets if there's a space in Data Extension name, otherwise they are not needed.

Select
l.EmailAddress,
l.First_Name,
l.Last_Name,
l.Company,
l.Phone,
l.userIp,
l.disclaimerTerms,
l.timeStamp
from _ListSubscribers l
where ListName = 'Whitepaper_Download_Test'
2
  • thanks for you suggestion, I thinks it may be something else, because I still receive the same error. Can it be the '_' in ListName? Jul 4, 2018 at 13:09
  • @Mateusz "I only use square brackets if there's a space in Data Extension name, otherwise they are not needed." This is wrong. I had a Dataextension starting with 000_ and the syntax always crashed until i put brackets around it. Jul 4, 2018 at 13:37
0

You got a wrong character in the where clause

where ListName = ‘Whitepaper_Download_Test'

Should be

where ListName = 'Whitepaper_Download_Test'

and after the l.timeStamp, should not be a comma.

==>

Select
l.EmailAddress,
l.First_Name,
l.Last_Name,
l.Company,
l.Phone,
l.userIp,
l.disclaimerTerms,
l.timeStamp
from [_ListSubscribers] l
where ListName = 'Whitepaper_Download_Test'

Let us assume you have the List Whitepaper_Download_Test and a dataextension B that has these fields: Email,First,Last,Comp,Phone,Ip,Terms,Time. (I changed to different fields that you get the point).

Select
l.EmailAddress AS Email,
l.First_Name AS First,
l.Last_Name AS Last,
l.Company AS Comp,
l.Phone AS Phone,
l.userIp AS Ip,
l.disclaimerTerms AS Terms,
l.timeStamp AS Time
from [_ListSubscribers] l
where ListName = 'Whitepaper_Download_Test'

Target Data Extension is B.

But i believe that doesnt fix your First_Name error. Are you sure it is in the List? Can you make a Screenshot of the Fields in that List(no values please)?

Just for reference: Here is the description of _ListSubscribers https://help.salesforce.com/articleView?id=mc_as_data_view_listsubscribers.htm&type=5

5
  • If this doesnt work, maybe erase the brackets and write from _ListSubscribers AS l Jul 4, 2018 at 13:38
  • Hi @Johannes, Thanks a lot for your help. I am now receiving the following error Invalid column name 'First_Name'. This is my first time writing a Query so I'm not sure how to move forward from here. I can confirm dat First_Name in my Attributes is also First_Name. Thanks in advance! Jul 4, 2018 at 18:14
  • Can you explain what you are going to do with the query? I believe I haven’t really understood your use case. Do you want to query this data from the list and store it into another data extension or what’s the plan. Jul 4, 2018 at 21:41
  • of course! So I am using WebCollect to store subscribers on a list. I want to add these subscribers to Salesforce through Journey Builder. I am not able to use the API, otherwise I could send people straight away to the data extension. So this is why I want to Query the people who are on a list and add them to a data extension, which I will use as a starting point for the Journey. Jul 5, 2018 at 6:20
  • Edited my answer. But i believe we need more and precise information from your end Jul 5, 2018 at 6:34

You must log in to answer this question.

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