SQLite Forum

Not Equal Operator
Login
Hi,
I'm having issues with not equal operator. It always returns 0 records. However when it is replaced with equal operator it works fine.

Here is an example;
I'm getting same result with Node.js and DB Browser for SQLite (3.11.2, SQLLite: 3.31.1)


**Table:**
<code>
CREATE TABLE "testTable" (
	"recordId"	INTEGER NOT NULL,
	"testColumn"	VARCHAR(36),
	PRIMARY KEY("recordId")
)
</code>

**Records:**
<code>
recordId	testColumn
1	testValue
2	<NULL>
3	testValue
4	<NULL>
5	testValue
6	<NULL>
</code>

**Not Equal Query:**
<code>
SELECT recordId FROM "testTable" WHERE ("testColumn" != "testValue") ORDER BY recordId ASC;
<code>

**Not Equal Query Result:**
<code>
Result: 0 rows returned in 8ms
</code>

**Equal Query:**
<code>
SELECT recordId FROM "testTable" WHERE ("testColumn" == "testValue") ORDER BY recordId ASC;
</code>

**Equal Query Result:**
<code>
recordId
1
3
5
</code>

As you can see equal operator working as expected but not equal operator return 0 rows instead of 3. This is a really simple query but i cannot point my finger.  Is it me or sqlite (probably not) ?