【问题标题】:Having issues while running select query on h2 database在 h2 数据库上运行选择查询时出现问题
【发布时间】:2017-01-02 11:56:44
【问题描述】:

我正在 H2 数据库上运行示例查询,如下所述 -

select count(*) from Employee where employee_name is not null;

但问题是 H2 不支持 is not null,请提出替代方案。

【问题讨论】:

标签: sql h2


【解决方案1】:

试试这个

select count(*) from Employee 

WHERE employee_name = ? or (employee_name is null and ? is null);

如果变量employee_name 的值为NULL,则表达式employee_name IS NULL 返回TRUE, 否则返回 FALSE。

【讨论】:

    猜你喜欢
    • 2016-01-24
    • 2015-02-25
    • 1970-01-01
    • 2020-04-23
    • 1970-01-01
    • 2010-11-01
    • 2018-08-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多