X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (developer.postgresql.org [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 85239B438AE for ; Fri, 4 Jul 2003 21:11:14 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 19880-02 for ; Fri, 4 Jul 2003 18:11:04 -0300 (ADT) Received: from mailout05.sul.t-online.com (mailout05.sul.t-online.com [194.25.134.82]) by svr1.postgresql.org (Postfix) with ESMTP id 5A817B43175 for ; Fri, 4 Jul 2003 18:11:00 -0300 (ADT) Received: from fwd00.aul.t-online.de by mailout05.sul.t-online.com with smtp id 19YXpd-0007JU-02; Fri, 04 Jul 2003 23:11:01 +0200 Received: from router.azrael.de (VUcygeZYgeOO97tH3ta9HiiMbemsp8ypKpug35lTeiZ9s8XdIBhyQu@[80.141.250.26]) by fmrl00.sul.t-online.com with esmtp id 19YXpY-1897WC0; Fri, 4 Jul 2003 23:10:56 +0200 Received: from azrael.azrael.de (azrael.azrael.de [192.168.202.18]) by router.azrael.de (8.11.4/8.11.4) with ESMTP id h64LAmG19121 for ; Fri, 4 Jul 2003 23:10:49 +0200 Date: Fri, 4 Jul 2003 23:11:02 +0200 From: Evil Azrael X-Mailer: The Bat! (v1.62r) Personal X-Priority: 3 (Normal) Message-ID: <158603745.20030704231102@evilazrael.de> To: pgsql-sql@postgresql.org Subject: INSERT ... SELECT problem in Mysql MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Seen: false X-ID: VUcygeZYgeOO97tH3ta9HiiMbemsp8ypKpug35lTeiZ9s8XdIBhyQu@t-dialin.net X-Archive-Number: 200307/48 X-Sequence-Number: 14162 Hi! I was trying to port a solution from postgresql to mysql for a mysql user. im often using INSERT ... SELECTS with the same table in the INSERT and SELECT statments at the same time. In Postgres i used to use the destination only in a Subquery with IN, but in Mysql i had to join the table, but it didn´t work and threw this error : INSERT TABLE 'dummy' isn't allowed in FROM table list with this page explaining the error : http://www.mysql.de/doc/en/INSERT_SELECT.html I have a problem with this part in the text ---- The target table of the INSERT statement cannot appear in the FROM clause of the SELECT part of the query because it's forbidden in standard SQL to SELECT from the same table into which you are inserting. (The problem is that the SELECT possibly would find records that were inserted earlier during the same run. When using subquery clauses, the situation could easily be very confusing!) ---- Is that correct? PostgreSQL allows this which is very handy, but breaks so some ANSI compliance. Can anyform that ANSI SQL doesn´t allow this? Thanx Christoph Nelles -- Mit freundlichen Grüssen Evil Azrael mailto:evilazrael@evilazrael.de