SQLite Forum

Error: no such column: x
Login
Here is another alternate and more succinct spelling that should obtain the same results:

```
  SELECT a.*, b.AnnualDossier as Dossier
    FROM (
          SELECT DISTINCT ProjID
            FROM Project_List
         ) as o,
    JOIN Project_List as a
      ON a.ProjID == o.ProjID
     AND a.InsertDate == (
                          select max(InsertDate)
                            from Project_List
                           where ProjID == o.ProjID
                          )
    JOIN ABT_Budget as b
      ON b.ProjID == o.ProjID
     AND b.InsertDate == (
                          select max(InsertDate)
                            from ABT_Budget
                           where ProjID == o.ProjID
                          )
   WHERE a.PMO_Board_Report != 'No'
     AND CASE WHEN a.Target_Go_Live_Date == ''
              THEN a.Finish_Date > substr(date('now'),1,4) || '-01-15'
              ELSE a.Target_Go_Live_Date > substr(date('now'),1,4) || '-01-15'
         END
ORDER BY o.ProjID
;
```