Results 1 to 4 of 4
  1. #1
    Join Date
    May 2012
    Posts
    2

    Unanswered: Track Message Access 2010 sql - update & select

    Hello everyone, my first time here.

    Please help me figure out why this doesn't work in Access and if there is an alternative. I am trying to fill the column in table 1 with data from column in table 2.

    UPDATE table1
    SET t1_name = (SELECT t2_name FROM table2 where t2_id = t1_id);

    (I tried a similar query in Oracle and it worked)

  2. #2
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    Welcome to the forum.

    Provided that t1_id and t1_name are the names of existing columns in table1 and that t2_id and t2_name are the names of existing columns in table2, you should try:
    Code:
    UPDATE table1 INNER JOIN table2 ON table1.t1_id =  table2.t2_id
    SET table1.t1_name = table2.t2_name;
    Have a nice day!

  3. #3
    Join Date
    May 2012
    Posts
    2
    Thanks for replying, Sinndho. That works wonderfully. I wonder why the necessity of joining the two tables?

  4. #4
    Join Date
    Mar 2009
    Posts
    5,441
    Provided Answers: 14
    You're welcome!

    Note: Please keep in mind that, although the Jet Engine (SQL interpretor) of Access can process a (quite) large subset of the SQL language, there are some limitations if you take SQL Server or Oracle as a reference.
    Have a nice day!

Posting Permissions

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