Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » DBISAM Technical Support » Support Forums » DBISAM SQL » View Thread |
Messages 1 to 7 of 7 total |
Null joins |
Tue, Mar 7 2006 12:06 AM | Permanent Link |
Oliver Bock | In DBISAM, comparing NULL to itself returns TRUE. Under normal
circumstances this presents few problems for me, although it begs the question of why "is null" exists. However when chaining left outer joins, it can lead to strife and an explosion of unwanted results. e.g. select * from T1 left outer join T2 on T1.ID = T2.ID left outer join T3 on T2.Other = T3.Other If T3.Other is sometimes NULL and the first join fails, then the second join will succeed, although this is unlikely to be what was intended! A bit of unscientific research using Google suggests that Sybase, MS SQL Server and MySQL all consider the result of NULL = NULL to be NULL, rather than TRUE. Why does DBISAM work as it does? Is this one of those situations that the standards are silent on? Oliver |
Tue, Mar 7 2006 3:26 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Oliver,
<< In DBISAM, comparing NULL to itself returns TRUE. Under normal circumstances this presents few problems for me, although it begs the question of why "is null" exists. However when chaining left outer joins, it can lead to strife and an explosion of unwanted results. e.g. select * from T1 left outer join T2 on T1.ID = T2.ID left outer join T3 on T2.Other = T3.Other If T3.Other is sometimes NULL and the first join fails, then the second join will succeed, although this is unlikely to be what was intended! A bit of unscientific research using Google suggests that Sybase, MS SQL Server and MySQL all consider the result of NULL = NULL to be NULL, rather than TRUE. Why does DBISAM work as it does? Is this one of those situations that the standards are silent on? >> No, the standards are quite clear that NULL = NULL should return NULL. I'll have to look into this further and see what the reasons are, because I believe that compatiblity with ranges has something to do with it. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Mar 7 2006 3:35 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Oliver,
It's because we allow for using the = operator with NULLs like this: MyField = NULL This is a legacy thing from back before we allowed IS NULL with filters, and the filters are the underlying basis for the joins, WHERE clause, etc. -- Tim Young Elevate Software www.elevatesoft.com |
Tue, Mar 7 2006 4:20 PM | Permanent Link |
Oliver Bock | Tim Young [Elevate Software] wrote:
> It's because we allow for using the = operator with NULLs like this: > > MyField = NULL > > This is a legacy thing from back before we allowed IS NULL with filters, and > the filters are the underlying basis for the joins, WHERE clause, etc. I guess you won't want to break existing code by changing the behavior in WHERE clauses and filters, but what about in JOINs? How about in v5? Oliver |
Wed, Mar 8 2006 12:19 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Oliver,
<< I guess you won't want to break existing code by changing the behavior in WHERE clauses and filters, but what about in JOINs? How about in v5? >> Version 5 has ANSI standard SQL NULL compliance. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Mar 8 2006 1:16 PM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Hisss Boooo
Roy Lambert |
Thu, Mar 9 2006 3:53 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Hisss Boooo >> That I can handle. Just no more 300-post threads about the NULLs. -- Tim Young Elevate Software www.elevatesoft.com |
This web page was last updated on Tuesday, April 30, 2024 at 03:55 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |