Parse failure doing UPDATE FROM
I'm trying to do an UPDATE FROM and getting a parse failure I don't understand. I'm wondering if anyone can explain what I'm doing wrong. SQLite 3.23.1, built from the amalgamation. Using the command-line shell, I do (if I've copied it correctly) ATTACH '../customers/cust.db' AS cdb; UPDATE idmap SET btn = c.foo FROM (SELECT servID AS userId, btn AS foo FROM cdb.live GROUP BY userId, btn HAVING COUNT(*) = 1) AS c WHERE c.userId = idmap.userId and I get Error: near "FROM": syntax error The subquery works fine when run on its own. I've been staring at the syntax for UPDATE and so far have been unable to see my mistake.
SQLite 3.23.1, built from the amalgamation.
According to https://sqlite.org/news.html update from was added in 3.33.
Doh! One of the reasons I dislike webpages as documentation - it's easy to version-skew (indeed, it's hard to avoid version-skew) between what you're using and the doc you're looking at. I did try to find something helpful in the code comments, but couldn't find the UPDATE FROM doc there. Now I know why; I should have taken that as a bigger clue. Thank you; my apologies for the noise. I'll be fetching newer code.
I am no expert, but I have figured out that if I am going to do anything with a tool, I would use the latest version of the tool, and then go to previous version if the need is there. :-) Just thinking out loud. :-)