Using Sequel I’d like to create an UPDATE statement like the following (from Postgres docs)
UPDATE employees SET sales_count = sales_count + 1 FROM accounts
WHERE accounts.name = 'Acme Corporation'
AND employees.id = accounts.sales_person;
However, looking at the Sequel documentation it’s not clear where there’s any way to create the FROM clause.
Is there a way to do this?
Thanks!
OK, Ben Lee’s answer got me going in the right direction. Solution:
I’m a bit uncertain about the use of
.lithere, but it does seem to do the trick. (Also, I’m usingupdate_sqlrather thanupdateto produce the SQL output rather than running the command.)Result, as desired: