New to ET and have written a query in the automation studio. I have two tables I am looking through and am trying to return what matches my LIKE condition. The LIKE is looking for emails from TableA that have a name from TableB in it. It does not seem to return anything at the moment and I was wondering if anyone could see what I am doing wrong.

Additional Info: I was asked to find gender based on Name in TableA but most of the records lack a Name. Since some emails have a person's name in it I am trying to check email as well. TableB has a Name column and a Gender column.

SELECT TableA.Name, TableA.Email, TableB.Gender
ON TableA.Name = TableB.Name OR TableB.Name LIKE '%' + TableA.Email + '%'
  • Why would you try to match for rows in TableB where the Name is like an email address? – Adam Spriggs Jul 25 '17 at 19:47
  • What columns are in TableB? – Adam Spriggs Jul 25 '17 at 19:49
  • 1
    Please do not create multiple user accounts. It is an abuse of the system and may get you banned. If you need to merge accounts, please go through the contact us link to reach out to the Community Management team. – Adrian Larson Jul 26 '17 at 15:56

I finally got to a solution that works for me. Open to suggestions of course but this gets me the results I needed. Again, working in Exact Target.

    SELECT TableA.Name, TableA.Email,TableB.Gender 
    FROM TableA INNER JOIN TableB 
    ON TableA.Name = TableB.Name OR  TableB.Name LIKE 
    SUBSTRING(TableA.Email,0, CHARINDEX('@', TableA.Email,0))

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.