SQLite Forum

inner join bug with compound queries
Login
Further notes in case they are helpful

```
WITH
T1 (x) AS (SELECT 10),
T2 (y) AS (SELECT 1),
T3 (z) AS (
  SELECT * FROM T2 WHERE false
  UNION ALL
  SELECT * FROM T2
)
SELECT *
  FROM T1, T2, T3;
```

Also fails the same way.
But if you use `LEFT JOIN` instead of `INNER JOIN` it works.

If you remove T1 from the equation or use T2 two times it works.

If you remove the useless `UNION ALL` it works (in the real query it's not useless)

By "it works" I mean "it returns one row as expected".