Results 1 to 2 of 2

Thread: in one UPDATE query - select a value from une table to fulfill in another table.

  1. #1
    Join Date
    Nov 2006
    Posts
    1

    in one UPDATE query - select a value from une table to fulfill in another table.

    Hi,
    A little new in SQL (6 years I don't worked with SQL
    I have 2 tables A and B (A are the timesheets records and B are the projects with their data) and I need for many different analysis to fulfill in the A table, column "code" the analysis code of the project (B.code).
    The problem is that I work with MS-Access mdb (not adp) and thus I can't create stored procedures with cursors and fetch, so I need this in one query

    I tried:
    UPDATE A.code
    SET (SELE B.code FROM A, B WHERE (A.projectName=B.projectName));

    but it returns a warning that update is possible with only one record in the subquery (what is logical) have you any idea of how to make the proper/right SQL please? Thank you.

  2. #2
    Join Date
    Nov 2002
    Location
    New Jersey, USA
    Posts
    3,932
    Try this

    update a
    set a.code = b.code
    from a
    join b
    on a.projectname=b.projectname

Posting Permissions

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