That should be:

with mt(a, b) as (select i, j from ...)
update tab
   set x = (select a from mt where b = y)
 where y in (select b from mt);

mt is a table/view (albeit a temporary one), so the update statement is no 
different than if you were updating the contents of one table from the contents 
of any other table.

---
Theory is when you know everything but nothing works.  Practice is when 
everything works but no one knows why.  Sometimes theory and practice are 
combined:  nothing works and no one knows why.


>-----Original Message-----
>From: sqlite-users-boun...@sqlite.org [mailto:sqlite-users-
>boun...@sqlite.org] On Behalf Of scaun...@web.de
>Sent: Monday, 15 December, 2014 15:14
>To: sqlite-users@sqlite.org
>Subject: [sqlite] recursive update
>
>Hi,
>
>I need to implement a recursive update for some reason.
>
>So I'm trying to start to implement a stupid with-clause update and that
>stops me immediately.
>
>The update does not recognize the table or columns of the with clause
>table:
>
>
>with mt(a, b) as ( select i, j from ... )
> update tab
>    set x = mt.a
>  where y = mt.b
>
>
>error message : there is no column mt.a.
>
>What is wrong ?
>
>I tried to find some mailing on that but its very hard because the search
>engine delivers nearly everything for the search phrases " with clause
>update".
>
>Anybody out there who can help ?
>
>Simon
>
>
>
>
>_______________________________________________
>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