SQLite Forum

Error: no such column: x
Login
Forget that being faster.  I have no clue how to convince the query optimizer to not execute the correlated subquery multiple times, so you are better off leaving the NULLs alone since they don't hurt anything.

However, this may still be faster, even though it still may have nulls:

```
with maxes (ProjID, pl_insert, ab_insert)
  as (
      select ProjID,
             (select max(InsertDate) from Project_List where ProjID == o.ProjID) as pl_insert,
             (select max(InsertDate) from ABT_Budget where ProjID == o.ProjID) as ab_insert
        from (
              select distinct ProjID
                from Project_List
             ) as o
     )
select *
  from maxes
;
```