On 2/4/16, TJ O'Donnell <tjo at acm.org> wrote:
> I was expecting the json_group_array aggregate function to leave out null,
> behaving like other aggregate functions.  Is this to be expected?
>
> sqlite> create table x (a integer);
> sqlite> insert into x values (1), (2), (null),(4);
> sqlite> select group_concat(a), json_group_array(a) from x;
> group_concat(a)  json_group_array(a)

If I did that, then it would be impossible to generate a JSON array
using json_group_array() that contained NULL entries.  As it is, you
can usually include or omit the NULL entries using a term in the WHERE
clause:

     select json_group_array(a) from x where x is not null;


-- 
D. Richard Hipp
drh at sqlite.org

Reply via email to