I’ve used the SQL command line in phpMyAdmin to update my database directly before (rather than writing a C script). I’m wondering if it’s possible to do something a little more complicated.
I have two tables. tableB is currently empty, and exists because I want to change the structure of tableA. (I want to drop snum from tableA.)
tableA
-------
unum (int)
snum (int)
etc
tableB
-------
unum (int)
snum (int)
What I need to do is create one record in tableB for each and every record in tableA, copying across unum and snum as I go. Then I will remove snum from tableA and henceforth use a LEFT JOIN to combine the tables. (The problem is that there can be multiple snum values for each unum which wasn’t originally foreseen.)
Is it possible to populate tableB just through a MySQL command in phpMyAdmin, or do I need to write a little script?
Thanks.
loop isn’t necessary here, you can simply do this since you want to copy rows from
tableAtotableB. executeINSERT INTO...SELECTstatement,follow-up question: what will be the value for
snumsince there are many of them on eachunum? do you want to insert it all or selected only?