Far Cry Posted September 26, 2010 Share Posted September 26, 2010 Hey there, I was wondering if this is possible with mysql, my goal is to transfer the users id from the users table to the id field in my status table, thanks in advance. NOTE: Not manually, through a script. Link to comment https://forums.phpfreaks.com/topic/214437-transferring-data-from-one-table-to-another-edited/ Share on other sites More sharing options...
litebearer Posted September 26, 2010 Share Posted September 26, 2010 Yes it is possible, have you tried? what are the structures of the two tables? Link to comment https://forums.phpfreaks.com/topic/214437-transferring-data-from-one-table-to-another-edited/#findComment-1115892 Share on other sites More sharing options...
Far Cry Posted September 26, 2010 Author Share Posted September 26, 2010 Yes it is possible, have you tried? what are the structures of the two tables? users table id first_name last_name gender username email password avatar bio month day year invitational last_login active code locked date ip online Status table id bigint(20) username status status_date Link to comment https://forums.phpfreaks.com/topic/214437-transferring-data-from-one-table-to-another-edited/#findComment-1115898 Share on other sites More sharing options...
rwwd Posted September 26, 2010 Share Posted September 26, 2010 Usually the order of doing this is:- SELECT FROM table1<--On success of this instruction Proceed to the next INSERT INTO table2<-- On success of this instruction, optionally do the next, but it is good house keeping... DELETE FROM table1<--On completion of the above, you can display a nice little message to screen This is kinda a pseudo way of doing a MOVE as there isn't a specific 'MOVE' command that I have found. Hope that makes sense. Rw Link to comment https://forums.phpfreaks.com/topic/214437-transferring-data-from-one-table-to-another-edited/#findComment-1115963 Share on other sites More sharing options...
jcbones Posted September 27, 2010 Share Posted September 27, 2010 You want to transfer all of the users Id's $sql = "INSERT INTO Status(id) SELECT id FROM users"; Link to comment https://forums.phpfreaks.com/topic/214437-transferring-data-from-one-table-to-another-edited/#findComment-1116128 Share on other sites More sharing options...
chintansshah Posted September 27, 2010 Share Posted September 27, 2010 still you have an error? Link to comment https://forums.phpfreaks.com/topic/214437-transferring-data-from-one-table-to-another-edited/#findComment-1116196 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.