KingOfHeart Posted March 16, 2010 Share Posted March 16, 2010 I have many accounts on my forum. Every now and then I delete accounts that have no posted even once. So I want to merge ids so there are no gaps. Can you help? UPDATE smf_arcade_favorite SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_arcade_games SET ID_MEMBER_CHAMPION = YYY WHERE ID_MEMBER_CHAMPION = XXX; UPDATE smf_arcade_personalbest SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_arcade_rates SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_arcade_scores SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_attachments SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_collapsed_categories SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_gallery_comment SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_gallery_pic SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_actions SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_banned SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_boards SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_errors SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_mark_read SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_notify SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_online SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_polls SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_log_topics SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_members SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_messages SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_moderators SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_personal_messages SET ID_MEMBER_FROM = YYY WHERE ID_MEMBER_FROM = XXX; UPDATE smf_pm_recipients SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_polls SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_topics SET ID_MEMBER_STARTED = YYY WHERE ID_MEMBER_STARTED = XXX; UPDATE smf_topics SET ID_MEMBER_UPDATED = YYY WHERE ID_MEMBER_UPDATED = XXX; UPDATE smf_tp_articles SET authorID = YYY WHERE authorID = XXX; UPDATE smf_tp_data SET ID_MEMBER = YYY WHERE ID_MEMBER = XXX; UPDATE smf_tp_dlmanager SET authorID = YYY WHERE authorID = XXX; UPDATE smf_tp_shoutbox SET value5 = YYY WHERE value5 = XXX; UPDATE smf_tp_variables SET value3 = YYY WHERE value3 = XXX; XXX and YYY is the IDs. I'm thinking I need to combine their joindate and use a while loop. Quote Link to comment https://forums.phpfreaks.com/topic/195489-reordering-ids/ Share on other sites More sharing options...
trq Posted March 17, 2010 Share Posted March 17, 2010 You shouldn't play around with primary keys. What does it matter if there are gaps? Quote Link to comment https://forums.phpfreaks.com/topic/195489-reordering-ids/#findComment-1027420 Share on other sites More sharing options...
KingOfHeart Posted March 18, 2010 Author Share Posted March 18, 2010 I just don't like having a member with an id of 500 then it skips all the way to 50000. So can you please help. I have backup in case if the worst shall happen. Quote Link to comment https://forums.phpfreaks.com/topic/195489-reordering-ids/#findComment-1027886 Share on other sites More sharing options...
fenway Posted March 22, 2010 Share Posted March 22, 2010 I just don't like having a member with an id of 500 then it skips all the way to 50000. That's too bad. Learn to like it. The worst will happen, forever. Don't do it. Quote Link to comment https://forums.phpfreaks.com/topic/195489-reordering-ids/#findComment-1030173 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.