thanks! On Wed, Oct 21, 2020 at 3:24 PM Jeremy Evans <[email protected]> wrote:
> On Wed, Oct 21, 2020 at 10:59 AM Benjamin Hutton <[email protected]> > wrote: > >> hello! >> >> We are trying to figure out how to do something like the "from values" >> part of this SO answer in sequel: https://stackoverflow.com/a/18799497 >> >> update test as t set >> column_a = c.column_a >> from (values >> ('123', 1), >> ('345', 2) >> ) as c(column_b, column_a) >> where c.column_b = t.column_b; >> >> I can't, for the life of me, figure out how to make `from values` (let >> alone `as`) work together. >> > > DB.from{[test.as(:t), DB.values([['123', 1], ['345', 2]]).as(:c, > [:column_b, :column_a])]}. > where{{c[:column_b]=>t[:column_b]}}. > update(:column_a=>Sequel[:c][:column_a]) > > UPDATE "test" AS "t" > SET "column_a" = "c"."column_a" > FROM (VALUES ('123', 1), ('345', 2)) AS "c"("column_b", "column_a") > WHERE ("c"."column_b" = "t"."column_b") > > Thanks, > Jeremy > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sequel-talk" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sequel-talk/q1Fb8yXxgvo/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sequel-talk/CADGZSSeP7pmQ8WWM3A8WKrbnVkGGhLkktB0RPBVPRWPx7xRgcA%40mail.gmail.com > <https://groups.google.com/d/msgid/sequel-talk/CADGZSSeP7pmQ8WWM3A8WKrbnVkGGhLkktB0RPBVPRWPx7xRgcA%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/sequel-talk/CAFuLn7nm8-upE97sKMTwE9HnsTPNpHXtLomdKi_WSz3ocE%2BgUQ%40mail.gmail.com.
