Please verify you are human

[Guide] Database Cleanup
  Register for your free account! | Forgot your password?

You last visited: Today at 20:11

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Guide] Database Cleanup

Discussion on [Guide] Database Cleanup within the EO PServer Guides & Releases forum part of the EO PServer Hosting category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Feb 2010
Posts: 268
Received Thanks: 329
[Guide] Database Cleanup

Tired of having more account then characters? of people that created mutiple accounts but just use 1 or when people deleted there characters.

Here is a way to get rid of these

Code:
SELECT DISTINCT
account. *
FROM account
LEFT JOIN cq_user ON account.id = cq_user.account_id
WHERE
account.id = ( cq_user.account_id)
This query will give you a new table with account that have a character bounded to it.
Once you got this
Export the new table into a sql file
Empty you old account table
Import this new sql file into your account table

Your done

Similar code to clean up items and eudemons for delete character

Code:
SELECT DISTINCT
cq_item.*
FROM cq_item
LEFT JOIN cq_user ON cq_item.player_id = cq_user.id
WHERE
cq_item.player_id = ( cq_user.id)

SELECT DISTINCT
cq_eudemon. *
FROM cq_eudemon
LEFT JOIN cq_user ON cq_eudemon.player_id = cq_user.id
WHERE
cq_eudemon.player_id = ( cq_user.id)
Regards SweetCandy[PM]
no_1 is offline  
Thanks
2 Users
Old 09/30/2012, 17:29   #2
 
elite*gold: 0
Join Date: Jul 2012
Posts: 80
Received Thanks: 40
Why would you want to select the entries then export when you can just delete them from the database all in one step. The following is an example for the account table, it will delete all the rows from account where a character doesn't exist.

Code:
DELETE account FROM account 
LEFT JOIN cq_user ON account.id = cq_user.account_id 
WHERE cq_user.account_id IS NULL
Gekru is offline  
Old 10/01/2012, 13:44   #3
 
funhacker's Avatar
 
elite*gold: 20
Join Date: Sep 2007
Posts: 1,767
Received Thanks: 1,747
also... doing a select distinct is used for selecting only 1 of many copies
an example would be

Code:
select distinct ownerid from cq_goods;
This will return all the owner ids within cq_goods without showing duplicates, this can be handy if you want to know what npc's sell items
however doing a select distinct * in a table with a primary key is pointless as it will never have duplicate entries...
funhacker is offline  
Thanks
2 Users
Old 12/08/2015, 03:37   #4
 
elite*gold: 0
Join Date: Sep 2009
Posts: 188
Received Thanks: 65
Quote:
Originally Posted by Gekru View Post
Why would you want to select the entries then export when you can just delete them from the database all in one step. The following is an example for the account table, it will delete all the rows from account where a character doesn't exist.

Code:
DELETE account FROM account 
LEFT JOIN cq_user ON account.id = cq_user.account_id 
WHERE cq_user.account_id IS NULL
how bout if we want to delete items n eudemons that players doesnt exist.
haizamlee is offline  
Reply


Similar Threads Similar Threads
Guide pour Sauvegarder sa base de donnée FR/US Guide to Saving the database! FR/US !
01/18/2012 - Rappelz Private Server - 2 Replies
Bonjour, Petit guide (By darckistyle) pour faire une sauvegarde de son serveur ! Vous ne vous êtes jamais dit : comment sauvegarder ma base de donnée en cas de crash ? Car si vous pensez que dans le sql que toutes vos donnée qui y sont sont aussie dans le fichier ou se situe la base de donnée, C'EST UNE GRANDE ERREUR ! Vous pouvez toujour faire un copier collée, rien est sauvegarder, il vous faut faire une sauvegarde manuelle pour gardé toutes vos donnée.
Inventory Breaking/Cleanup Guide -Breaking Any Item Without Guilt
08/24/2011 - Grand Chase Philippines - 12 Replies
For those who are still having problems on inventory spaces, being unable to add any items in their inventory because it is already full or nearly full, here is a guide to free up a lot of space. There are items which could be sold, items which could be broken or both. Sell those unuseful items or break them as you wish to free up your inventory space. Item breaking, of course is thru the use of DK-P Type 0812 or more commonly known as the crafting/breaking machine on your grand chase Menu tab...
Database cleanup
08/11/2011 - Dekaron Private Server - 7 Replies
Hey guys, is it possible to clean up several databases with a simple script? For example i want to clean the user_character, user_bag and so on but my character entry should remain.
[SQL Question]Database cleanup
03/03/2011 - Dekaron Private Server - 9 Replies
so i am trying to perform my own databse cleanup(as i and about 4 other people have already mad a char with the existing db) but everytime i try to delete all account but ours they are all gone...i know verry little about SQL but this should be pretty simple should it not...this is what query i am running on the account database: delete * from tbl_user where user_no<>firstnumber or user_no<>secondnumber or user_no<>thirdnumber or user_no<>fourthnumber but all accounts are gone even the...



All times are GMT +1. The time now is 20:12.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.