Autor Tema: How to remove inactive guilds  (Leído 1235 veces)

Desconectado Louis

  • *
  • *


  • 1267

    178

    25981
  • br
  • Louis Emulator
    • +55 15 997401274 +55 15 997401274
    • louisemulator louisemulator
For those who have had a server for a long time, it is a good idea to clean up the guilds from time to time, so I made a query for you to check how long a guild GM has not logged in.

Remember to do this with the server OFFLINE, with the dataserver closed and make a backup first.

This selects all the guilds whose GM has not logged in for more than 365 days (you can change the time):
SELECT G_Name,MEMB_STAT.ConnectTM from Guild INNER JOIN Character on Guild.G_Master = Character.Name INNER JOIN MEMB_STAT on Character.AccountID = MEMB_STAT.memb___id where MEMB_STAT.ConnectTM < (GetDate()-365)

In this case you change to DELETE to delete all these guilds:
DELETE G from Guild G INNER JOIN Character on G.G_Master = Character.Name INNER JOIN MEMB_STAT on Character.AccountID = MEMB_STAT.memb___id where MEMB_STAT.ConnectTM < (GetDate()-365)

Finally, to delete the guilds you need to delete all members of the guilds that no longer exist:
DELETE from GuildMember where not exists (select Name from Guild where Guild.G_Name = GuildMember.G_Name)

Credits
louis
Update 44 ready
www.jogandomu.com.br
Discord: louisemulator

Gracias:


 

.