Results 1 to 3 of 3

Thread: Mergeing Tables

  1. #1
    Join Date
    Aug 2003
    Location
    Nelson, New Zealand
    Posts
    4

    Question Unanswered: Mergeing Tables

    I need to update table1 with a field value from table2.
    If both tables contain (among other fields)...

    firstname
    surname
    barcode

    Table1 has the barcode value in it which needs to populate the equivilant field in table2 (when the names match).
    Occasionaly we will need to run a query to do this. I have tried (in my newbie kind of why) to do this is several ways but can't seem to strike the 'right' way.
    Can somebody point me in the right direction?

  2. #2
    Join Date
    Aug 2003
    Location
    Delft, The Netherlands (EU)
    Posts
    447

    Re: Mergeing Tables

    Look up the Update syntax (T-SQL) and write:

    UPDATE Table1
    SET Barcode = T2.Barcode
    FROM Table1 T1 INNER JOIN Table2 T2 ON T1.FirstName = T2.FirstName and T1.SurName = T2.SurName and ....
    Make everything as simple as possible, but not simpler! - A. Einstein
    DB Problems? DB Explorer, BTrieve Re-engineering, DB Conversions & ETL? Conversion Tool

  3. #3
    Join Date
    Aug 2003
    Location
    Nelson, New Zealand
    Posts
    4

    Smile Thanks

    Thanks for that... I'd never come across an INNER JOIN before. Reading up on it now. Looks promising...

Posting Permissions

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