Jump to content

help with connecting two tables


brown2005

Recommended Posts

Hey....

I have

table 1
---------------------

field - letter

and have 26 records for this

then i have

table 2
--------------------

fields - table2_id and table2_letter

and 26 records for this.

what i want to do is select a letter from table 1 and put it in field table2_letter but not duplicate it

any ideas please?
Link to comment
https://forums.phpfreaks.com/topic/7037-help-with-connecting-two-tables/
Share on other sites

If you want them in the same sequence

[code]INSERT INTO table2 (letter) SELECT letter FROM table1[/code]

If you want them in a random sequence

[code]INSERT INTO table2 (letter) SELECT letter FROM table1 ORDER BY RAND()[/code]

This assumes table2.id is auto_increment column.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.