On 06/07/2017 17:01, Domingo Alvarez Duarte wrote:
I already did this before but it was not accepted.

For myself I did a modification on sqlite3 to allow the use of "AS" on delete/update statements.

You can see the parser part here https://github.com/mingodad/sqlite/blob/decimal64/src/parse.y .

Cheers !

Thank you Domingo, but that option is beyond my programming competence.




On 06/07/17 05:16, John McMahon wrote:
Hi

Wondering if someone else can spot the syntax error in the following statement. "locns" is an attached database. There are four "AS" terms in the statement, they all alias tables.

Ok, found it. It seems that an alias for an "UPDATE" table name is not permitted. Is there a particular reason for this? I would think it a convenience especially when using long table names and attached databases.

John

sqlite>     UPDATE locns.xxx_last_delivery AS tgt
  ... >      SET
  ... >         tgt.del_date =  (
  ... >              SELECT src.last_del_d
  ... >              FROM   main.updates AS src
  ... >              WHERE  src.custnum = tgt.custnum),
  ... >         tgt.del_qty = (
  ... >              SELECT src.last_del_q
  ... >              FROM   main.updates AS src
  ... >              WHERE  src.custnum = tgt.custnum)
  ... >      WHERE
  ... >         tgt.custnum  = (
  ... >              SELECT src.custnum
  ... >              FROM   main.updates AS src
  ... >              WHERE  src.last_del_d IS NOT NULL
  ... >              AND    src.last_del_d > tgt.del_date)
  ... >  ;
Error: near "AS": syntax error


_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

--
Regards
   John McMahon
        j...@jspect.fastmail.com.au
        04 2933 4203

_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to