new field to table?

  • Thread starter Thread starter VilMarci
  • Start date Start date
V

VilMarci

Hi,

I have a table like:

ID,LotsOfDataFields

and now I have to add one field to the first one based on this second table:

ID,NTuserID

Like:

now: 1,DataFields
and should be 1,DataFields,NTuserID

How is this possible to do this? The new coloumn for NTuserID is there, I
only need to enter the ID-s... What makes the situation a bit hard, that not
all of the first table have NT accounts, so their NTuserID field should
remain blank...

Thanks for all help,

Marton
 
Hi Marton,

You use update queries to do this. They are fairly easy to do with the
query builder. But, if you paste the following sql in sql view of a new
query it should do the trick for you, but you will have to replace Table1 and
Table2 with the actual table names (Table1 is the one being updated):

UPDATE Table1 INNER JOIN Table2 ON Table1.ID = Table2.ID SET Table1.NTUserID
= Table2.NTUserID;

After substituting the table names, you can switch to design view to see
what this would look like in the query builder if you were to construct it
that way.

HTH, Ted Allen
 
Back
Top