Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

NULL on joined columns

Dec 24 2008 12:00AM by Madhivanan   

You know that NULL values on joined columns are omitted from comparision 
when tables are joined Consider this example
Declare @t1 table(col1 int, col2 varchar(10))

insert into @t1
select 1, 'test1' union all
select 2, 'test2' union all
select NULL,'test3' union all
select 5,' test4' 

Declare @t2 table(col1 int, col2 varchar(10))

insert into @t2
select 1, 'testing1' union all
select 2, 'testing2' union all
select NULL, 'testing3' union all
select 3, 'testing4' 

select t1.col1,t2.col2 from @t1 as t1 inner join @t2 as t2 on t1.col1=t2.col1 

--The result is

col1       col2
----------- ----------
1           testing1
2           testing2 

What if you want to compare NULL values too and get the value testing3? The query is

select t1.col1,t2.col2 from @t1 as t1 
inner join @t2 as t2 on t1.col1=t2.col1 or (t1.col1 is null and t2.col1 is null) 

--and the result is

col1      col2
----------- ----------
1           testing1
2           testing2
NULL      testing3

Tags: t-sql, sql_server, null, join,


Madhivanan
3 · 40% · 12947
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]