SQLTeam.com | Weblogs | Forums

Joining tables by rep name


Hello everyone,
I'm trying to join two tables by sales rep name. However, one table has the name in this order last name, first name. The other table is first name, last name. Has anyone attempted to join a table this way? I've tried google, but I'm mostly getting information on converting order formats for names. As always, any and all help is greatly appreciated. Thank you!



That can be an extremely complex process once you get into all the details of it, and the huge number of ways names can be configured (middle name(s), multi-word first and/or last names, special prefixes (such as "von" in German), and so on).

The only accurate way to do that is to store the name in separate parts: first name, middle name, last name, etc..


I agree with what Scott said, but if the name, in each table, has an e.g. comma separator between the names such as "First Name, Last Name" and "Last Name, First Name" it would be possible to split that and re-join the two halves the other way round, and then use that to JOIN to the other table.

Performance will be horrible though ... but might not matter if small number of rows and/or infrequent usage


Thank you all for your help with this issue. I figured out a work around that didn't require me to join by name!