I want to create a table of test data which is based upon existing values from my Address table.
For example I want to take a random first name value, last name value, address etc and insert this into a new row in my TestAddress table. There are around 10 columns in total.
Is there a nice way to do this without having to do one select for each column value per row?
For example
INSERT INTO TestAddress(Titel,Vorname,Nachname,Strasse,Hausnummer,Zusatz,PLZ,ORT)
VALUES(
SELECT Titel FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT Vorname FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT Nachname FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT Strasse FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT Hausnummer FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT Zusatz FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT PLZ FROM Adressen where ID = FLOOR(RAND()*50000000) ,
SELECT ORT FROM Adressen where ID = FLOOR(RAND()*50000000)
)
Note that the above example does not work.