Query to look in two columns in a table for the same value
Posted on 2010-11-30
Hello. I have a custom MS SQL 2005 SP3 database used in SCCM 2007 OSD deployments. The database contains a table that has four columns. The columns are computer name, old computer name, mac address and date name was changed.
I am trying to write a query that looks at the values in the computer name column and the value name in the old computer name column, if the same value is in both colums it outputs it. The value will not be on the same row so I cannot do a match.
For example, I have a machine called Computer1. It is both the computername and oldcomputername columns. I want the query to output all values for both rows that it is in. Is this possible?
Below is my query to pull in everything from the table.