I am struggling to resolve a SQL syntax problem in a Laravel Eloquent query. So I've gone right back to the root, and tried to get a query working in simple SQL. And I'm stumped. I'm no expert, but this is baffling me.
I've had a look at the Update with Join in SQLite post, but I think that one is more around the issue of joins.
I'm testing this on SQLLite, which surely is representative of SQL proper?
Two tables: Instructions and Knowns. I want to update one column in the Knowns from (the latest) Instructions. Get that right, and I can solve the rest myself (I hope!).
-- This works fine
Select instructions.rowid from instructions 
where instructions.EngagementTitle not null
-- This doesn't
UPDATE knowns 
SET    EngagementTitle = instructions.EngagementTitle
WHERE  id IN (
  SELECT knowns.id 
  FROM   knowns 
  INNER JOIN instructions 
  ON knowns.reference = instructions.reference
) 
Error Message
no such column: instructions.EngagementTitle: 
UPDATE knowns 
SET    EngagementTitle = instructions.EngagementTitle 
WHERE  id IN (
  SELECT knowns.id 
  FROM   knowns 
  LEFT JOIN instructions 
  ON knowns.reference = instructions.reference
) 
Both tables both have the column - triple checked.
`EngagementTitle` varchar NOT NULL
What am I missing?
 
    