On Saturday, December 31, 2016 at 10:57:35 AM UTC-8, Steve V wrote: > > On Sat, Dec 31, 2016 at 12:09 PM, Jeremy Evans <[email protected]> > wrote: > > > > What version of Sequel are you using? The code I posted should work > fine > > with the latest release. If you are running on an older release, you > need > > to upgrade to use it. I tested the code before I posted it to make sure > it > > resulted in the SQL you posted (modulo quoting and other unimportant > syntax > > differences). > > > > Thanks, > > Jeremy > > You were right. I was on a year old version of Sequel. I updated to > the latest version, and that got rid of those errors. After cleaning > up a few mistakes on my part in my modified query I got it to run. The > only part I couldn't figure out was setting the new field based off > adding multiple fields together. > > I tried using a proc to create the `update` SET, but the SET clause > just kept ending up blank when I wrote it like this: > > update{balance = pc[:funded] + pcs[:activity] } > > Sequel::DatabaseError: PG::SyntaxError: ERROR: syntax error at or near > "FROM" > LINE 1: UPDATE "period_categories" AS "pc" SET FROM (SELECT "pc2"...
Dataset#update doesn't take a block. You probably want: update(:balance=>Sequel[:pc][:funded] + Sequel[:pcs][:activity]) Thanks, Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sequel-talk. For more options, visit https://groups.google.com/d/optout.
