Thread: SQL Question
View Single Post
  #4  
Old 07-05-2003, 04:20 PM
Lurker_005
Demi-God
 
Join Date: Jan 2002
Location: Tourist town USA
Posts: 1,671
Default

Ok, this isn't entirely that usefull yet, but it allows making a copy of the data used for a given zone to a temporary database. I will try to make a script or VB app to do a lot more, and eventually re-import the data so that it can be mixed and matched with other zones.

anyhow, the mysql commands, be sure to replace database and zone_shortname (first and 4th lines)

Code:
use database; 
drop database lurk_temp; 
create database lurk_temp; 

create table lurk_temp.spawn2 select * from spawn2 where zone = 'zone_shortname'; 
create table lurk_temp.spawnentry select spawnentry.* from spawnentry, lurk_temp.spawn2 where spawnentry.spawngroupid = lurk_temp.spawn2.spawngroupid; 
create table lurk_temp.spawngroup select spawngroup.* from spawngroup, lurk_temp.spawn2 where spawngroup.id = lurk_temp.spawn2.spawngroupid; 
create table lurk_temp.npc_types select npc_types.* from npc_types, lurk_temp.spawnentry where npc_types.id = lurk_temp.spawnentry.npcid; 

create table lurk_temp.grid select grid.* from grid, lurk_temp.spawn2 where grid.id = lurk_temp.spawn2.pathgrid; 
create table lurk_temp.city_defense select city_defense.* from city_defense, lurk_temp.npc_types where city_defense.npcid = lurk_temp.npc_types.id; 
create table lurk_temp.merchantlist select merchantlist.* from merchantlist, lurk_temp.npc_types where merchantlist.merchantid = lurk_temp.npc_types.merchant_id; 

create table lurk_temp.npc_faction_entries select npc_faction_entries.* from npc_faction_entries, lurk_temp.npc_types where npc_faction_entries.npc_faction_id = npc_types.npc_faction_id; 
create table lurk_temp.npc_faction select npc_faction.* from npc_faction, lurk_temp.npc_faction_entries where npc_faction.id = npc_faction_entries.faction_id; 
create table lurk_temp.faction_list select faction_list.* from faction_list, lurk_temp.npc_faction where faction_list.id = lurk_temp.npc_faction.faction_id; 

create table lurk_temp.loottable select loottable.* from loottable, lurk_temp.npc_types where loottable.id = lurk_temp.npc_types.loottable_id; 
create table lurk_temp.loottable_entries select loottable_entries.* from loottable_entries, lurk_temp.loottable where loottable_entries.loottable_id = lurk_temp.loottable.id; 
create table lurk_temp.lootdrop select lootdrop.* from lootdrop, lurk_temp.loottable_entries where lootdrop.id = lurk_temp.loottable_entries.lootdrop_id; 
create table lurk_temp.lootdrop_entries select lootdrop_entries.* from lootdrop_entries, lurk_temp.loottable_entries where lootdrop_entries.lootdrop_id = lurk_temp.loottable_entries.lootdrop_id; 

create table lurk_temp.doors select doors.* from doors, lurk_temp.spawn2 where doors.zone = lurk_temp.spawn2.zone; 
create table lurk_temp.zone select zone.* from zone, lurk_temp.spawn2 where zone.short_name = lurk_temp.spawn2.zone; 
create table lurk_temp.zone_points select zone_points.* from zone_points, lurk_temp.spawn2 where zone_points.zone = lurk_temp.spawn2.zone; 
create table lurk_temp.zonepoints_raw select zonepoints_raw.* from zonepoints_raw, lurk_temp.spawn2 where zonepoints_raw.zone = lurk_temp.spawn2.zone; 
create table lurk_temp.forage select forage.* from forage, lurk_temp.zone where forage.zoneid = lurk_temp.zone.zoneidnumber;
Then from the dos command line:
c:\mysql\bin\mysqldump.exe lurk_temp > zone_shortname.sql
to save the results to a file.[/b]


***EDIT: was using old faction tables, updated for 4.4 DB structure***
__________________
Please read the forum rules and look at reacent messages before posting.
Reply With Quote