Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2001
    Location
    MD, USA
    Posts
    2

    Question Unanswered: COnverting from Sybase to Postgres

    I think this is a simple question, but I can't find any reference to it in the manuals. In Sybase, I have a simple query to increment a column value:
    Code:
    UPDATE company_ids
    SET    next_id = next_id + 1
    FROM   company_ids ci, project p
    WHERE  ci.company_id = p.company_id
    AND    project_id = 1;
    When I execute this query in Postgres (7.3.3), I get the following error:

    ERROR: Column reference "next_id" is ambiguous

    I also tried to add table prefixes:
    Code:
    UPDATE company_ids
    SET    ci.next_id = ci.next_id + 1
    FROM   company_ids ci, project p
    WHERE  ci.company_id = p.company_id
    AND    project_id = 1;
    but then get this error:

    ERROR: parser: parse error at or near "." at character 29

    Am I missing something obvious? Thanks,

    Chuck

  2. #2
    Join Date
    Aug 2001
    Location
    MD, USA
    Posts
    2

    Re: COnverting from Sybase to Postgres

    FYI...Here is a way to make it work...

    Code:
    UPDATE company_ids
    SET    next_id = next_id + 1
    WHERE  company_id IN (SELECT company_id
                                           FROM   project
                                           WHERE  project_id = 1);

Posting Permissions

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