Update with Join in SQLite

This will work

UPDATE 
      software
SET purchprice = (SELECT purchprice
                  FROM softwarecost
                  WHERE id = software.id) 
where EXISTS (SELECT purchprice
                  FROM softwarecost
                  WHERE id = software.id)

Here we use exists because
without that the query will set software.purchprice to null if no “correlated” row is found.

Leave a Comment

tech