zontrakulla Posted April 6, 2009 Share Posted April 6, 2009 Hello, i'm still a newbie on mysql, i have a phpbb running and i want to move all banned users to a group by sql query.. The logic is: getting ban_userid values which is bigger than 0 from phpbb_banlist table and update their group_id value to 10 in phpbb_users table. phpbb support guys seems not willing to help in mysql questions Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/ Share on other sites More sharing options...
Maq Posted April 6, 2009 Share Posted April 6, 2009 You need to use a LEFT JOIN and an UPDATE. Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802863 Share on other sites More sharing options...
zontrakulla Posted April 6, 2009 Author Share Posted April 6, 2009 wow complicated Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802872 Share on other sites More sharing options...
zontrakulla Posted April 6, 2009 Author Share Posted April 6, 2009 Sorry couldn't find the edit button, i'm completely lost about using LEFT JOIN :-\ Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802896 Share on other sites More sharing options...
corbin Posted April 6, 2009 Share Posted April 6, 2009 What exactly do you not get about it? Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802926 Share on other sites More sharing options...
zontrakulla Posted April 6, 2009 Author Share Posted April 6, 2009 Using it, never seen "left join" before Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802928 Share on other sites More sharing options...
corbin Posted April 6, 2009 Share Posted April 6, 2009 http://www.phpfreaks.com/tutorial/data-joins-unions http://www.w3schools.com/Sql/sql_join.asp http://www.sql-tutorial.net/SQL-JOIN.asp http://www.tizag.com/sqlTutorial/sqljoin.php Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802933 Share on other sites More sharing options...
zontrakulla Posted April 6, 2009 Author Share Posted April 6, 2009 I guess i did it. UPDATE phpbb_users INNER JOIN phpbb_banlist ON user_id = ban_userid SET group_id = 10 Thanks. Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-802940 Share on other sites More sharing options...
Maq Posted April 6, 2009 Share Posted April 6, 2009 Yeah that looks about right. Although, you may need a left join rather than inner, but if it works I guess I'm wrong. Link to comment https://forums.phpfreaks.com/topic/152882-solved-newbie-question/#findComment-803001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.