sqldesigneralteryx

Alteryx Designer - How to retrieve only first and last name from field excluding middle initials?


I need help in writing SQL code in Alteryx Designer.

My table employees contains a column Name with values shown below. However, I need the expected output as shown below.

Please help.

Name:

  1. Smith, Mary K
  2. Koch, J B
  3. Batoon Rene, Anne S
  4. Vaughan-tre Doctor, Maria S

Excepted output:

  1. Smith, Mary
  2. Koch, J
  3. Batoon Rene, Anne
  4. Vaughan-tre, Maria

The middle initials and “Doctor” word is removed.


Solution

  • Not sure why you need to use SQL if you have the data in Alteryx?

    So, you need to remove the right hand 2 characters and the word 'Doctor' from each record?

    You could use the Formula tool, though I suspect there are numerous other ways:

    replace (TrimRight([Name],' '+right([Name],1)),'Doctor','')