create table newTableOne
select A.name as groupA, B.name as groupB, C.name as groupC
from tableOne, tableTwo as A, tableTwo as B, tableTwo as C
where tableOne.groupA = A.ref_id
and tableOne.groupB = B.ref_id
and tableOne.groupC = C.ref_id;

Then re-add your indices and integrity constraints, double check that the
new table is what you want, and replace your old table with the new one.

If you might have defunct foreign keys, then you will probably prefer left
joins to the above...


On 30/5/02 at 5:55 am, barry kwok <[EMAIL PROTECTED]> wrote:

> I have a table one with the following format:
>        groupA    groupB    groupC
>        ref1      ref2       ref1
>        ref2      ref3       ref2
>        ref4      ref2       ref1
> 
> another table two will have the full name for those
> ref.
>        ref_id     name
>        ref1       actual_name1
>        ref2       actual_name2
>        ref3       actual_name3
>        ref4       acutal_name4
> 
> how to make sql statement so that table one will be
> reformat so that ref number will be changed to
> actual_name.
> 
> 
>   
> 
> __________________________________________________
> Do You Yahoo!?
> Yahoo! - Official partner of 2002 FIFA World Cup
> http://fifaworldcup.yahoo.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
> 
> 


---------------------------------------------------------------------
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