On 12/1/16, Mark Brand <mabr...@mabrand.nl> wrote:
>
> Using SQLite version 3.15.2, the following SQL  returns 0 rows, whereas
> I believe it should return 1 row. Any of the commented out alternatives
> produces the expected 1 row.

Thanks for the clear and concise bug report.  The ticket is
https://www.sqlite.org/src/tktview/2df0107bd268


>
> Mark
>
> CREATE VIEW W AS
>      SELECT 0 show_a;
>
> CREATE VIEW X AS
>              SELECT   'A' a,  1 v
>      UNION SELECT 'B',    1;
>
> CREATE VIEW Y AS
>      SELECT * FROM W JOIN X;
>
> SELECT CASE WHEN group_by_a THEN a END a, SUM(v) v
> FROM Y
> LEFT JOIN (SELECT NULL group_by_a UNION SELECT 1) x2
>         ON show_a  AND a IS NOT NULL
>        --ON show_a = 1   AND  a IS NOT NULL
>        -- ON IFNULL(show_a, 0)  AND  a IS NOT NULL
>        --ON NOT(NOT(show_a)) AND  a IS NOT NULL
>   GROUP BY  CASE WHEN group_by_a THEN a END;
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to