HLRosenberger
asked on
Help with SQL - query name records
I have a table of employees, first, middle and last name columns along with other info. I want to query a list of all records where the first, middle and last name are the same, grouping by the same. There are also two other columns I want returned in the results, call them ID1 and ID2, and that will be different for each record. - How can I do this?
ASKER
I did not articulate my question correctly. Let me use an example; say I have these records:
Harold L Rosenberger 123 456
Harold L Rosenberger 111 333
Mary Jones 333 444
George Washington 333 444
George Washington 555 666
George Washington 123 877
George R Washington 155 876
Gary Lee Rogers 555 120
I want these records returned:
Harold L Rosenberger 123 456
Harold L Rosenberger 111 333
George Washington 333 444
George Washington 555 666
George Washington 123 877
Harold L Rosenberger 123 456
Harold L Rosenberger 111 333
Mary Jones 333 444
George Washington 333 444
George Washington 555 666
George Washington 123 877
George R Washington 155 876
Gary Lee Rogers 555 120
I want these records returned:
Harold L Rosenberger 123 456
Harold L Rosenberger 111 333
George Washington 333 444
George Washington 555 666
George Washington 123 877
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
that works, except for one case, where the middle name is NULL. How could I modify to handle this?
yeah, can't do a NULL = NULL, so a simple ISNULL conversion will work.
Change 'x' to whatever floats your boat.
I modified the code block above to keep the solution in one comment.
Change 'x' to whatever floats your boat.
I modified the code block above to keep the solution in one comment.
ASKER
Thanks!!
Thanks for the grade. Good luck with your project. -Jim
Open in new window
>I want to query a list of all records where the first, middle and last name are the same, grouping by the same.
if there's anything missing, please spell it out. I suspect that the above is missing some detail.