If you have synonym for rowid (i.e. column INTEGER PRIMARY KEY) or
some other unique columns combination then you can do something like
this:

INSERT OR REPLACE INTO table_1 (rowid, field_a, field_b, field_c, field_d)
SELECT table_1.rowid, table_2.field_a, table_2.field_b,
      table_2.field_c, table_2.field_d
FROM table_1, table_2 WHERE …


Pavel

On Thu, Aug 20, 2009 at 6:01 AM, Gerald Ebner<geraldo.eb...@gmail.com> wrote:
> Dear all,
>
> it seems that sqlite does not allow update statements of this kind:
>
> UPDATE table_1 SET (field_a, field_b, field_c, field_d) = (
>    SELECT field_a, field_b, field_c, field_d FROM table_2 WHERE …
> )
> WHERE ....
>
> I succeeded only with
>
> UPDATE table_1 SET
>   field_a = (SELECT field_a FROM table_2 WHERE … ),
>   field_b = (SELECT field_b FROM table_2 WHERE … ),
>   field_c = (SELECT field_c FROM table_2 WHERE … ),
>   field_d = (SELECT field_d FROM table_2 WHERE … )
> WHERE ....
>
> and that's may be not th optimal way, dealing with tables of a dozen of
> fields ....
>
> thanks in advance
> Geraldo
>
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to