Update Query Problem

  • I'm trying to run a simple update query that replaces the values in "Table A" with the new values from "Table B".  The problem I'm having is that my subquery returns more than 1 value and fails to execute at that point.

    Here's the query I'm trying to run.

    UPDATE tblAPP_DATA

    SET Appcryptic =

    (SELECT b.new_appcryptic

    FROM tblAPP_DATA a,

    tblUPDATES b

    WHERE a.appcryptic = b.new_appcryptic)

    How can I get this update query to work?  I tried to recreate this in Access by creating the same tables but with a smaller amount of data.  It worked fine there but not in SQL Server.  (I was hoping I could take the SQL generated by Access and use it in SS but that didn't even work.)  I even considered trying to do all my updates in Access but there's just too much data.

    I know this is a basic question but any advice is GREATLY appreciated!

    Thanks,

    Brian

     

  • You Almost Had it.

    UPDATE A

    SET Appcryptic = b.new_appcryptic

    FROM tblAPP_DATA a,

         tblUPDATES b

    WHERE a.appcryptic = b.new_appcryptic

    Update From, this should work, it will update the A.Appcryptic value = to the last b.new_appcryptic value found in table b

     

  • So close.  So far.  So frustrating!  LOL

    Thank you for your help.  That did the trick.

    Thanks again!

    Brian

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply