Whats the best way to copy a row mySQL table?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Whats the best way to copy a row mySQL table?
I need to copy a row in my table to another row, but one column cannot contain the same unique ID, that ID I need to tell it during copy.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
Re: Whats the best way to copy a row mySQL table?
Scusi, no capisce 

Re: Whats the best way to copy a row mySQL table?
I found this, anyway to translate to livecode? It copies everything from one record to the next except the first name and username
id first_name last_name username address city state
1 John Doe johndoe 123 Street Chicago IL
INSERT INTO `users` ( username, first_name, last_name, address, city, state )
SELECT "janedoe", "Jane", last_name, address, city, state
FROM `users`
WHERE `username`='johndoe'
id first_name last_name username address city state
1 John Doe johndoe 123 Street Chicago IL
2 Jane Doe janedoe 123 Street Chicago IL
id first_name last_name username address city state
1 John Doe johndoe 123 Street Chicago IL
INSERT INTO `users` ( username, first_name, last_name, address, city, state )
SELECT "janedoe", "Jane", last_name, address, city, state
FROM `users`
WHERE `username`='johndoe'
id first_name last_name username address city state
1 John Doe johndoe 123 Street Chicago IL
2 Jane Doe janedoe 123 Street Chicago IL
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här
Re: Whats the best way to copy a row mySQL table?
So username and firstname are the columns that have different values?
The INSERT statement you have should work fine with one small change - the string literals for JaneDoe and Jane should be in single quotes not double, although it will probably still work with doubles.
Just call revExecuteSQL with it and check the result after to makes sure it worked OK.
The INSERT statement you have should work fine with one small change - the string literals for JaneDoe and Jane should be in single quotes not double, although it will probably still work with doubles.
Just call revExecuteSQL with it and check the result after to makes sure it worked OK.
Re: Whats the best way to copy a row mySQL table?
I tried it and it works great thank you. single quote.
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här