Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Inner join on 2tables with columns havi nullvalues

Author  Topic 

kgundava
Yak Posting Veteran

66 Posts

Posted - 2011-08-02 : 15:46:11
Hi All,
I Would have to join tow tables where columns might end up having null values.Please let me know the best way to handle this issue.
Note:
1)As of now, i know that i can use ISNULL(ColumnA, 0)but i would believe it would considerably slow the results.
Thanks.....

mkr
Starting Member

1 Post

Posted - 2011-08-02 : 15:48:09
Hi kgundava

Can you please elaborate your problem?
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2011-08-02 : 15:53:15
You can do a join like what I am showing below. But, I don't know if that is what you want. You will get n times m rows on the null join if there are n rows that have col1 as null in one table and m rows with null col1 in the second table.
FROM
TableA a
INNER JOIN Tableb b ON
a.Col1 = b.col1 OR (a.col1 IS NULL AND b.col1 IS NULL)
Go to Top of Page

kgundava
Yak Posting Veteran

66 Posts

Posted - 2011-08-02 : 16:43:00
Thanks for the replies
@Sunita\MKP: I am doing this as a part of Data validation.I have a table on oracle and as well as Attunity Databases. I am trying to validate teh data by pulling a random data (1000 rows) from oracle and then using a join i am trying to find the same data in the attuntiy. This all is done sql server I am connecting to oracle and attuntiy via linked server's.
So ideally when i do a join or where clause i should get 1000 rows from Attunity(same as in oracle).Pleas let me know your thoughts...
Go to Top of Page
   

- Advertisement -