Skip to content

Is Null where clause not working #458

Closed

Description

@snarayanank2
var data = [{ dep: 'A', qt: 10, price: 5},
 { dep: 'A', qt: 5,  price: 2.30 },
 { dep: 'B', qt: null,  price: 2.20 }];

var res1 = alasql('SELECT * FROM ? WHERE qt is null',[data]);

The above piece of code is returning []. Here's a jsfiddle that demonstrates the problem. Similarly, is not null is including the row with null value.

Activity

  1. mathiasrw commented on Nov 18, 2015

    @mathiasrw
    Member

    Thank you for a good description

    I beleave its same problem as #368

    @agershun any inputs?

    Update: Found a syntax workaround !

    -- qt = null or 0 or false
    SELECT * FROM ? WHERE NOT qt;
    
    -- qt != null
    SELECT * FROM ? WHERE qt != null;  

    https://jsfiddle.net/7u1fxbq3/

  2. snarayanank2 commented on Nov 18, 2015

    @snarayanank2
    Author

    Ah thanks! I worked around the problem by creating a user defined function that does the null check. Would be nice to see this fixed, though.

  3. mathiasrw commented on Nov 19, 2015

    @mathiasrw
    Member

    @snarayanank2 Totally agree !

  4. mathiasrw commented on Oct 21, 2026

    @mathiasrw
    Member

    Is confirmed working in v4.20.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions