I create a table with the command `CREATE TABLE test1 (key text primary key, 
obj json);` with two records inserted

    # select * from test1;
    key1|{"a":1,"b":2,"c":{"x":99},"status":"done"} # record 1
    key2|{ "key": key2 } # record 2

Now I want to retrieve the record that is not marked with status "done" (so 
basically it is expected to return the second record i.e. record 2 with key2). 
The command I use is `select * from test1, json_tree(test1.obj) where 
json_tree.value <> "done";` But it returns

    key1|{"a":1,"b":2,"c":{"x":99},"status":"done"}|a|1|integer|1|2|0|$.a|$
    key1|{"a":1,"b":2,"c":{"x":99},"status":"done"}|b|2|integer|2|4|0|$.b|$
    key1|{"a":1,"b":2,"c":{"x":99},"status":"done"}|c|{"x":99}|object||6|0|$.c|$
    
key1|{"a":1,"b":2,"c":{"x":99},"status":"done"}|x|99|integer|99|8|6|$.c.x|$.c
    Error: malformed JSON

What is the correct SQL command to achieve such effect?

SQLite version I use is 3.11.0 2016-02-15 17:29:24

Thanks
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to