On Fri, 04 Jan 2002 00:58:19 +0200, "P.Agenbag"
<[EMAIL PROTECTED]> wrote:

| Hi
| I have two tables, one contains a persons name and an ID number. The 
| other table contains the ID number and another field. Is there a way of 
| moving this collumn to the first table to corrlate with the ID's, ie, 
| table 1 must now contains name, ID and another field that is specific to 
| the person. The two tables are not chronological ie. the 1st entry in 
| the one table is not nescessarily the first in the second table...

CREATE TABLE t3 (
   ID ...,
   pn ...,
   af ... );
INSERT INTO t3 (ID,pn,af) 
   SELECT t1.ID, t1.pn, t2.af 
   FROM t1 LEFT JOIN t2 USING ID;
ALTER TABLE t1 RENAME t1_old;
ALTER TABLE t3 RENAME t1;


Thanks,
Michael
--
Michael Brunson                          504.473.6643
[EMAIL PROTECTED]                 ICQ: 83163789
      ---   Intercosmos Media Group, Inc.  ---
      www.intercosmos.com    www.directnic.com 

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to