Jose Isaias Cabrera, on Monday, January 27, 2020 08:42 AM, wrote...
>
>
> Keith Medcalf, on Monday, January 27, 2020 04:02 AM, wrote...

This is actually what I need:

SELECT a.a,
         a.c,
         a.e,
         b.g,
         b.h,
         b.i,
         coalesce((
                   SELECT 'YES'
                     FROM t2
                    WHERE wYear == a.c
                      AND pid == a.a
                  ),  'NO') AS digital
    FROM t0 as a, t1 as b
   WHERE a.a == b.f
     AND a.idate == (SELECT MAX(idate) from t0 where a = a.a)
     AND b.idate == (SELECT MAX(idate) from t1 where f = a.a)
     AND a.c == 2020
;

Because there are other records that are in the other databases, but not in t2, 
which still need to be part of the result.  Thanks for everything Igor, Keith, 
Simon, and everyone who thought about it. ;-)

josé
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to