Simple update Table query based on 2 tables joined

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • userdave
    New Member
    • Nov 2008
    • 2

    Simple update Table query based on 2 tables joined

    Hi,

    Please can you assist me, I'm trying to execute some SQL to update 1 column to a constant value (50) in multiple rows in Table A based on an associated 'SOURCE' value in table B

    Table A joins to Table B based on the TableA.definiti on_id = TableB.Att_Def_ id

    like..

    update TableA
    set value =50
    where
    TableA.definiti on_id = TableB.Att_Def_ id
    and TABLEB.Source = 'NEWPRODUCT'

    Any help would be appreciated.

    Thanks
    Dave
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    Are You Facing Any Problem With That Code ?

    Comment

    • Pilgrim333
      New Member
      • Oct 2008
      • 127

      #3
      Hi,

      Take a look at this page:

      Update syntax

      Especially the part about "Update based on a single queried value" an "Update based on a query returning multiple values" Try to make the query, if you are having problems with it, post your problems here.

      Pilgrim.

      Comment

      • userdave
        New Member
        • Nov 2008
        • 2

        #4
        Well I was at the time, but I have now resolved whatever problems I had by using the..

        .... where TabeA.definitio n_id in (Select attribute_defin ition_id from tableB....

        statement.

        Thanks for taking the time to respond.

        Dave

        Comment

        • Pilgrim333
          New Member
          • Oct 2008
          • 127

          #5
          Sweet.

          Thanx for taking the time to share your solution.

          Pilgrim.

          Comment

          Working...