2

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
FROM TableA INNER JOIN TableB
ON TableA.Name = TableB.Name OR TableB.Name LIKE '%' + TableA.Email + '%'
3
  • Why would you try to match for rows in TableB where the Name is like an email address? Commented Jul 25, 2017 at 19:47
  • What columns are in TableB? Commented Jul 25, 2017 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
    Commented Jul 26, 2017 at 15:56

1 Answer 1

0

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))

You must log in to answer this question.

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