0

Would anyone be able to help me write a query activity in Marketing Cloud? I’m getting “multi-part identifier” errors and, when I try to put two tables in the FROM, I’m getting the error “Old style (ANSI JOINs) syntax not allowed.

What I’m trying to write for the query is: If settings.Number equals history.Number AND settings.ID is 1, then select all fields in the DE.

I thought I could do the below, but I was wrong.

SELECT * 
FROM settings, history
WHERE setting.Number = history.Number AND settings.ID = 1
  • Do they contain the same fields? – Gortonington Oct 12 '17 at 17:09
  • No. And the only matching field would be .*Number – Harley Oct 12 '17 at 17:11
  • and you want all the fields for both DEs? or just one? – Gortonington Oct 12 '17 at 17:12
  • All fields from the history table only. I was hoping to use the settings table to find records. – Harley Oct 12 '17 at 17:13
2

For SFMC you need to use JOINs (visual ref) to query multiple tables. With Joins, you need to use an 'ON' statement to signify what is the unique key to combine the two tables(or DEs in this case).

Below should do it for your needs:

SELECT hi.*

FROM History hi

INNER JOIN settings se

ON se.Number = hi.Number
WHERE se.ID = 1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.