I have a table with two columns containing Names (NameA and NameB columns)
I want to match these two columns to find which rows don’t match, meaning they have different characters.
James Bond James Bond
Steve Ray Steve Ray
Ellie Golden Natasha Kiss
So the end result would return the last row only as the two names don’t match, how can I write a sql script to do this
Try the below:
Select * From Table1 Where Col1<>Col2
Please use Marked as Answer if my post solved your problem and use Vote As Helpful if a post was useful.
What if NameA column has John Smith and the NameB has John Smile, are they different ?
Best Regards,Uri Dimant SQL Server MVP, http://sqlblog.com/blogs/uri_dimant/
MS SQL optimization: MS SQL Development and Optimization
MS SQL Blog: Large scale of database and data cleansing
Remote DBA Services: Improves MS SQL Database Performance