Jump to content
  • 0

How to kick all guilds members except masters?


Question

3 answers to this question

Recommended Posts

Posted

Run these SQL queries while your server is offline:

UPDATE `char` SET guild_id=0 WHERE char_id NOT IN (SELECT char_id FROM guild);

DELETE FROM guild_member WHERE char_id NOT IN (SELECT char_id FROM guild);

Posted (edited)

Use the query below to delete all members (except the leader) from guilds that have more than 70 members (you can change this number in the query).

CHANGE THE 70 BELOW TO THE NEW MAX GUILD MEMBER!!! 

DELETE `guild_member`
    FROM `guild_member`
    LEFT JOIN `guild`
        ON `guild_member`.`char_id` = `guild`.`char_id`
    WHERE
        `guild`.`char_id` IS NULL
        AND `guild_member`.`guild_id` IN (
            SELECT `guild_id` FROM ( SELECT COUNT(*) members, `guild_id` FROM `guild_member` GROUP BY `guild_id` HAVING members > 70 ) gids
        );
And this is to update the characters that are not in a guild.
UPDATE `char`
	SET `guild_id` = 0
	WHERE `char_id` NOT IN ( SELECT `char_id` FROM `guild_member`	);
Edited by Digos

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...