Article View: borland.public.vdbase.data.sql
Article #159Re: Are "<>" and "NOT =" equal?
From: Mark Berry
Date: Fri, 05 Mar 1999 00:00
Date: Fri, 05 Mar 1999 00:00
43 lines
1932 bytes
1932 bytes
Steve Koterski wrote: > > On Wed, 03 Mar 1999 11:36:50 -0800, Mark Berry <markb@nospam.mcbsys.com> > wrote: > > > That's what I figured the problem was -- before I even got that far down in > the article. Yes, the methods used in SQL (not just local SQL) are > different for NULL values. You cannot use the normal comparison operators > available in local SQL: NOT =, <>, or !=. You have to use the NOT NULL > predicate. > > For example: > > SELECT * > FROM ContSupp C > WHERE (C.AccountNo = "90CF-SYSTEM-REC") AND > ((C.RecType != "H") OR (C.RecType IS NULL)) Thanks, Steve, but as Nelson said, it seems to work fine with just NOT C.RecType = "H" Let's see if I understand this... The "=" operator will find the "H" row(s), so NOTting it will return all the other rows, including RecType of NULL (which is, I assume, how it sees an empty value in a table, though I didn't think dBASE5 tables supported null values). I have to admit it still isn't clear to me why that gives a different result than C.RecType <> "H" In that row, we're asking "Is NULL <> 'H'?". So the result is either True, or did I read somewhere that any expression with NULL in it returns NULL? If you can recommend a good book where I can find an explanation, by all means... Thanks, Mark Berry
Technical Details
Message-ID:
<36E0334D.B296E333@nospam.mcbsys.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<36DD8F52.A95841B5@nospam.mcbsys.com> <36e3e0f4.7014769@forums.inprise.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ff5a1,88c275fafdcf6395 X-Google-Attributes: gidff5a1,public From: Mark Berry <markb@nospam.mcbsys.com> Subject: Re: Are "<>" and "NOT =" equal? Date: 1999/03/05 Message-ID: <36E0334D.B296E333@nospam.mcbsys.com> X-Deja-AN: 451668017 Content-Transfer-Encoding: 7bit References: <36DD8F52.A95841B5@nospam.mcbsys.com> <36e3e0f4.7014769@forums.inprise.com> 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