select max(id)+1 as nextid from (select id from character_items
union all select id from character_teleport
union all select id from character_warehouse
union all select id from character_elf_warehouse
union all select objid as id from characters
union all select clan_id as id from clan_data
union all select id from clan_warehouse
union all select id from character_shop
union all select id from character_redeem_items
union all select objid as id from pets) t
這段是取最大ID的sql