1

It's a simple self join I am trying to do on below data

Input Data

and the O/P I am getting after running following query (This is not the complete output, just showing the null part of it)

select a.col1, a.col2, a.Length1, b.* 
from [dbo].[Combine] a 
  left join [dbo].[Combine] b on a.col1 =b.col1

part of Output

Why Null is getting compared and coming 9 times?

3

Maybe the column col1 for these rows has a literal string value of ‘NULL’ and not a missing value null indicator? - sqlraptor

You can test by adding the conditions and comparing the output of the queries:

WHERE a.col1 = 'NULL'

WHERE a.col1 IS NULL
  • Thanks for the answer Paul. It was a string 'NULL'. – Ayusha Jun 12 at 17:16
  • You can accept the answer by clicking the check mark under the voting buttons. – user126897 Jun 13 at 11:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.