Quantcast
Channel: Microsoft SQL Server
Viewing all articles
Browse latest Browse all 4871

SQL Server: Copy one column to another if they are not equal

$
0
0

I have a view in SQL server called OppoAddress. In this view, I have the fields oppo_postcode and addr_postcode. I'm trying to select all rows where oppo_postcode is not equal to addr_postcode.

Almost all rows have a value in addr_postcode and NULL in oppo_postcode, yet none are being displayed with this query:

SELECT * FROM OppoAddress
where oppo_postcode != addr_postcode

Does anyone have any idea why?

SQL
SELECT*FROMOppoAddresswhereoppo_postcode!=addr_postcode

Viewing all articles
Browse latest Browse all 4871

Trending Articles