Article View: borland.public.vdbase.data.sql
Article #54Are "<>" and "NOT =" equal?
From: Mark Berry
Date: Wed, 03 Mar 1999 00:00
Date: Wed, 03 Mar 1999 00:00
33 lines
1751 bytes
1751 bytes
Hi, More unexpected SQL behavior. Here part of a post from another forum I'm working with, news://gmnews.goldminesw.com/Public.GoldMine.Programming . As background, you need to know that ContSupp has one record with AccountNo = "90CF-SYSTEM-REC"; the RecType of that record is blank. Nelson/GM wrote: > Wierdness.. I tried the following: > > SELECT * FROM ContSupp WHERE (Contsupp.AccountNo = '90CF-SYSTEM-REC') and > (RecType <> 'H') > > And no records were returned. I should have seen one record. So then I > tried: > > SELECT * FROM ContSupp WHERE (Contsupp.AccountNo = '90CF-SYSTEM-REC') and > (NOT RecType = 'H') > > And guess what, my one record was returned! Very strange this SQL... After > some reading it turns out that SQL has three logic values, TRUE, FALSE or > NULL. My theory is that for some reason <> returns a NULL condition on an > unpopulated RecType like that used by the '90CF' record. This is probably > due to the fact that <> tests if a value exists (greater than or less than) > where as the NOT test that a value does not exist. Are "<>" and "NOT =" really supposed to give different results? Is Nelson correct that it has something to do with NULL? Thanks, Mark Berry
Technical Details
Message-ID:
<36DD8F52.A95841B5@nospam.mcbsys.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,88c275fafdcf6395,start X-Google-Attributes: gidff5a1,public From: Mark Berry <markb@nospam.mcbsys.com> Subject: Are "<>" and "NOT =" equal? Date: 1999/03/03 Message-ID: <36DD8F52.A95841B5@nospam.mcbsys.com> X-Deja-AN: 450863857 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Organization: MCB Systems Mime-Version: 1.0 Reply-To: markb@nospam.mcbsys.com Newsgroups: borland.public.vdbase.data.sql