There is table Departments
CREATE TABLE Departments
(
id int NOT NULL IDENTITY(1, 1) PRIMARY KEY,
name nvarchar(100) NOT NULL,
parentDepId int
);
I need to count the rows where parentDepId = NULL
, but my query returns zero every time.
SELECT COUNT(id) as DepartmentsCount
from Departments
WHERE parentDepId = NULL;
What's wrong with it?