Question: I have two columns as below:

| Column A | Column B |
| --- | --- |
| A1 | NULL |
| A1 | A1 |
| B1 | C1. |

When i query these columns as below :

SELECT Column A, Column B
from table
where Column A != Column B

i am expecting the following result:

| Column A | Column B |
| --- | --- |
| A1 | NULL |
| B1. | C1 |

But my query is only giving me the second line as result.

Answer: 
Consider below

```
select *
from your_table
where columnA is distinct from columnB    

```

with output

[![enter image description here](https://i.stack.imgur.com/QtavW.png)](https://i.stack.imgur.com/QtavW.png)
Null values do not participate in equality operations as there is no value to compare with.

You will need to include a check for null into your comparisoon statement.

```
SELECT Column A, Column B from table where  ISNULL(Column A,0) <> ISNULL(Column B,0)

```