How to copy text fields from one table to another?

How to copy text fields from one table to another?

Post by aa » Tue, 10 Feb 1998 04:00:00



I have two tables with text fields:

Table1:  id,    text_field
Table2:  id,    text_field

I need to copy text from Table 1 to Table 2 for a particular ID.
I tried:
 update table1 set text_field=(Select text_field from table2 where id=<some
value>)

But this does not work.

How can I do it?

 
 
 

How to copy text fields from one table to another?

Post by George Hartin » Wed, 18 Feb 1998 04:00:00


Just use the UPDATE FROM syntax as follows:

UPDATE Table1
   SET Table1.text_field = Table2.text_field
   FROM Table1, Table2
   WHERE Table1.id = Table2.id



> I have two tables with text fields:

> Table1:  id,    text_field
> Table2:  id,    text_field

> I need to copy text from Table 1 to Table 2 for a particular ID.
> I tried:
>  update table1 set text_field=(Select text_field from table2 where id=<some
> value>)

> But this does not work.

> How can I do it?