How do I do an update on a join where the value is based on the joined
table, e.g. something like

  UPDATE t1
    SET t1.c1 = CONCAT(t1.c2, t2.c3)
  FROM
    t2
  WHERE t1.id=t2.id AND t2.c1 IS NULL;

I've had trouble using DBIC and had to resort to a custom, hackish
`update_from` method, but before I do any further work to turn it into a
generic DBIC component for CPAN, is there already a way to do this with
existing DBIC or add-ons for DBIC?

FWIW, I'm using Postgres but as far as I know most databases handle UPDATE
FROM syntax (with the exception of MySQL, unsurprisingly, which uses UPDATE
JOIN).
_______________________________________________
List: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/DBIx-Class/
Searchable Archive: http://www.grokbase.com/group/dbix-class@lists.scsys.co.uk

Reply via email to