Register for your free account! | Forgot your password?

You last visited: Today at 17:30

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

 

Sql Query help

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2012
Posts: 102
Received Thanks: 4
Exclamation Sql Query help

Hello,

i like to ask for help. to create a sql query to remove unwanted accounts in the database for example

Database Auth= Table Accounts

Field Name:
Account

test
test1
test2
test3
test4
test5

Database Telecaster = Table Characters

Field Name:
Account

test2
test3
test4
test5

i like to run a query to remove all account records in Database Auth except if they exist in the Database Table characters (Field name Account)

in this case it should remove test and test 1 and keep test2/3/4/5 in both
if there is anyone that is able to help me it would be great!



Mslolita is offline  
Old   #2
 
elite*gold: 0
Join Date: Dec 2008
Posts: 39
Received Thanks: 48
this is just example delete the name value LIKE 'test'

SELECT * FROM [Auth].[dbo].[Account] WHERE account LIKE '%test%'

if value to delete exists, just run the query below

DELETE FROM [Auth].[dbo].[Account] WHERE account LIKE '%test%'

do same for character..

and here some query code to remove the deleted char.

SELECT * FROM [Telecaster].[dbo].[Character] WHERE name LIKE '%@%'

DELETE FROM [Telecaster].[dbo].[Character] WHERE name LIKE '%test%'


malaysiawap is offline  
Thanks
1 User
Old   #3
Moderator
 
elite*gold: 1
Join Date: Dec 2012
Posts: 3,004
Received Thanks: 958
That's nice but it will delete all accounts with 'test' in the name regardless if there are created characters or not.

So if someone created an account named 'johnnytest' it will be deleted.

I think the OP wants to delete all accounts that never created a character.
ThunderNikk is offline  
Old   #4
 
elite*gold: 0
Join Date: Apr 2011
Posts: 273
Received Thanks: 69
use auth delete from accounts where account_id not in (select account_id from telecaster.dbo.Character)


TheSuperKiller is offline  
Thanks
1 User
Old   #5
 
elite*gold: 0
Join Date: Dec 2012
Posts: 102
Received Thanks: 4
Thank you very much!

Quote:
Originally Posted by TheSuperKiller View Post
use auth delete from accounts where account_id not in (select account_id from telecaster.dbo.Character)


Mslolita is offline  
Reply



« Previous Thread | Next Thread »

Similar Threads
Query
Hey leute :) Wollte fragen ob jemand ein TuT oder die Query von den rüssis hat wie man die einfügt. :D & ihr braucht jetzt nicht kommen machs...
1 Replies - Metin2 PServer - Discussions / Questions
Query
woher bekommt man die Query von einer waffe?
1 Replies - Metin2 PServer - Discussions / Questions
[Suche]Query für "Alteklinge, Reichsklinge" &' Stichdolche NUR QUERY!
Ich weiß ich werd nervig aber ich suche die Query's für Alteklinge, Reichsklinge &' Strichdolche Why? Naya, weil ich in der DB i-wie nur...
1 Replies - Metin2 PServer - Discussions / Questions
A Query
Hi, First off, i'm an addict for 12sky 2. I play both 12sky 2 PH and 12sky 2 aeria. All the hax i find here for aeria server has been very...
6 Replies - 12Sky2



All times are GMT +2. The time now is 17:30.


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

Support | Contact Us | FAQ | Advertising | Privacy Policy
Copyright ©2017 elitepvpers All Rights Reserved.