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
 Select Query - Null Value Problems -Sql Server2008

Author  Topic 

paramu
Posting Yak Master

151 Posts

Posted - 2010-01-09 : 03:55:39
Hi,
I have a select query, but facing problems because of null values.

Select t1.*,t2.project_name from Sales_DB..item_master t1,Project_DB..project_master..t2 where t1.invoice_no='100' and
t2.project_code=t1.project_code

From the above query, table t1.project_code is null values [no datas are there] and table t2.project_code is also contains null values [no data].

So how to select for this type of value...

Thanks For The Guidences..




Paramu @ PARANTHAMAN

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-09 : 07:39:58
project_code is used to join item_master with project_master hence it makes no sense to join the null values and it makes no sense that project_code is null.
Maybe you can be more clear with example data and wanted output.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-01-09 : 10:12:29
do you mean this?


Select t1.*,t2.project_name from Sales_DB..item_master t1
join Project_DB..project_master t2
on isnull(t2.project_code,-1)=isnull(t1.project_code,-1)
where t1.invoice_no='100'
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-01-09 : 10:20:33
Sorry but I can see no sense on joing unrelated records.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page
   

- Advertisement -