This is technically valid CASE syntax which is why you're not getting an error, it's just not what you're looking for. ... CASE (SELECT c.WYear FROM t2 WHERE pid = a.a) WHEN c.WYear = 2020 THEN “YES” ELSE “NO” END ) AS DIGITAL ...
What that is saying is take the value you get from this: (SELECT c.WYear FROM t2 WHERE pid = a.a) and compare it to the value you get from this: (c.WYear = 2020) and if those two values match, then return the value of the field that's named "YES" (I'm assuming you wanted 'YES' there) (c.WYear = 2020) is a perfectly valid expression... that's returning a boolean (well, int) So you're comparing c.WYear (from the subquery) against a boolean. (Others have replied with improved versions of the query, but for people following at home I figured I'd try to point out why the original version parsed ok and ran, just wasn't what you intended) _______________________________________________ sqlite-users mailing list sqlite-users@mailinglists.sqlite.org http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users