我正在H2数据库上运行示例查询,如下所述 -
select count(*) from Employee where employee_name is not null;
但问题是H2不支持is not null
,请建议可以替代的方法。
答案 0 :(得分:0)
试试这个
select count(*) from Employee
WHERE employee_name = ? or (employee_name is null and ? is null);
表达式employee_name IS NULL如果变量employee_name的值为NULL,则返回TRUE, 否则返回FALSE。