Results 1 to 4 of 4
  1. #1
    Join Date
    Nov 2003
    Location
    DE
    Posts
    6

    Unanswered: delete statement over 2 tables

    hello,

    my problem is to delete some rows in a table by joining another table:

    DELETE FROM
    tableA
    WHERE
    tableA.rowA='1'
    AND
    tableB.rowB=tableA.rowA;

    this produces errors:

    SQL0206 "SCHEMA.TABLE.ROW" is not a valid in this context SQLSTATE 42703
    Database is DB2 8.1.4 on NT

    where is this error come from? i think its not possible to join another tables in a delete statement...is this right?

    thank you!

    poekel

  2. #2
    Join Date
    Jan 2003
    Posts
    1,605
    Hi,

    Try to write subselect, something like:

    DELETE FROM
    tableA
    WHERE
    rowA='1'
    AND
    rowA in (select rowB from tableB);

    Hope this helps,
    Grofaty
    Last edited by grofaty; 12-01-03 at 07:42.

  3. #3
    Join Date
    Nov 2003
    Location
    DE
    Posts
    6
    ok thanx, i try this...

    poekel

  4. #4
    Join Date
    Nov 2003
    Location
    DE
    Posts
    6
    yes it works!

    thanx again...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •