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.
| Author |
Topic |
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-11 : 13:07:28
|
| select * from table1 ainner join table2 b on b.id = a.idinner join table3 c on c.col1 = a.col1where a.name = 'something'The issue is that id can contain null values in table1, table 2 and col1 can contain null values in table1 and table3.SA |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-11 : 13:11:37
|
| ok and you want to match nulls as well from them? |
 |
|
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-11 : 13:34:47
|
| No if it is null I want to obviously ignore those values. SA |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-11 : 13:36:45
|
| it will ignore nulls by default |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-11 : 13:39:48
|
| b/w what is your ansi nulls setting status? check using below queryEXEC sp_dboption 'yourdatabase', 'ANSI nulls' |
 |
|
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-11 : 13:42:43
|
| Yes. But if 'id' and 'col1' is null there are values in table1 that need to be displayed. Its giving 0 rows which is incorrectSA |
 |
|
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-11 : 13:44:29
|
| okay that query :EXEC sp_dboption 'yourdatabase', 'ANSI nulls'gives "OFF"SA |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-11 : 13:47:03
|
| then it comparison with NULLs evaluates to true. b/w if your attempt is to display table1 rows regardless of match in others use left join |
 |
|
|
agarwasa2008
Posting Yak Master
109 Posts |
Posted - 2009-12-11 : 13:48:48
|
| That was it! Thanks!SA |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2009-12-11 : 13:49:29
|
| welcome |
 |
|
|
|
|
|