Delete Guilds With No Members


Published:   Comment: No Comments

游戏数据库

A simple query to delete empty Guilds (when they have only GuildMasters)!

Code:

alter table guild nocheck constraint all
alter table guildmember nocheck constraint all
delete from guild
where EXISTS (
SELECT m.G_Name,count(*) as memb from GuildMember m
where guild.g_name=m.G_name
group by m.G_Name
having count(*) <2
)

Use this at your own risk! (Cuz what if the Guild is made just yet... It will be deleted ^^)

none
Last Modified:2023-12-19 01:22:15

我有话说