Update Query

  • In someone else's question, I found this answer (below) which may provide a solution but I'm not sure. I have a table with over 1000 records that I need to update. I need to add a specific birth_date to a give ID. I need to make sure the correct birthday is given to the correct ID. I have the birthdays available in a document outside of the database.

    ---possible/partial solution?---
    update tablea set col1 = b.col1
    from tablea a
    join tableb b on a.id = b.id
    where 1 = 1
    order by b.LastUpdateDate
    ----end possible/partial solution----

    For example, I need a way to match the following:

    ID          Birthday
    1           1954-12-12
    004        1976-4-20
    15896     2012-1-30
    5           1974-05-12

  • You should put the birthdays with their id in a table. Then your query will work.
    Also, you don't need the last two lines at the end of your query:
    where 1 = 1
    order by b.LastUpdateDate

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

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