Jump to content
  • 0

Simple SQL query to remove Guild Members but NO Guild Leaders


Olrox

Question


  • Group:  Members
  • Topic Count:  87
  • Topics Per Day:  0.02
  • Content Count:  1335
  • Reputation:   932
  • Joined:  10/26/11
  • Last Seen:  

Hello just asking... how to make 2 simple queries on a rathena database.

Query 1:

How a sql query on a rAthena database, would be... to remove all the lines into the 'guild_member' table but not the lines that has char guild master that are into the 'guild' table.

the 'char_id' column is common on both tables.

Query 2:

To do a query to set the 'guild_id' column inside the 'char' table to the value = '0' to all the lines but, not the lines that has char guild master into the 'guild' table

Again, the 'char_id' column is common on bot 'char' and 'guild' table on this one.

Why I'm doing this? I'm reducing the max_guild_size of one server, and I need to clean the guild members, so all the guilds will have only 1 member (guild master).

Thanks in advance

Edited by Olrox
Link to comment
Share on other sites

2 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  75
  • Topics Per Day:  0.02
  • Content Count:  2223
  • Reputation:   593
  • Joined:  10/26/11
  • Last Seen:  

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

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

edit: you're welcome!

Edited by Brian
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  87
  • Topics Per Day:  0.02
  • Content Count:  1335
  • Reputation:   932
  • Joined:  10/26/11
  • Last Seen:  

Thanks brian!

Link to comment
Share on other sites

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.

×
×
  • Create New...