#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    75
    Rep Power
    9

    UPDATE OR INSERT INTO from Query


    I am not able to run the following query

    SQL Code:
    UPDATE OR  INSERT INTO SomeTable (fld1,fld2,fld3)  VALUES
    (SELECT fld1,fld2,fld3 FROM someOtherTble )
    MATCHING (fld1) ;


    It return an error
    Please help me.. Thanks in advance

    Edit :
    Error Showing: Invalid token. Dynamic SQL Error. SQL error code = -104. Token unknown - line 3, column 2. SELECT.
    Firebird version 2.1 On Windows Xp prof.
    Last edited by biju_ps; December 15th, 2010 at 01:58 AM.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2006
    Location
    Plovdiv. Bulgaria
    Posts
    224
    Rep Power
    12
    For Firebird valid statements are

    INSERT INTO TABLE (FIELDS..) VALUES (....);

    or

    INSERT INTO TABLE (FIELDS) SELECT .... FROM ....

    or

    UPDATE OR INSERT INTO TABLE (FIELDS)
    VALUES(....)
    MATCHING (FIELDS)

    You are trying to use some combination from all of them.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2008
    Posts
    75
    Rep Power
    9
    Originally Posted by mIRCata
    For Firebird valid statements are

    INSERT INTO TABLE (FIELDS..) VALUES (....);

    or

    INSERT INTO TABLE (FIELDS) SELECT .... FROM ....

    or

    UPDATE OR INSERT INTO TABLE (FIELDS)
    VALUES(....)
    MATCHING (FIELDS)

    You are trying to use some combination from all of them.
    Thanks for the quick reply.

    So i cannot use the above syntax right ?
    I will try to restructure my query.

    regards

IMN logo majestic logo threadwatch logo seochat tools logo