How to delete all banned accounts [MySQL]
#1

Hi guys,

I want to delete all banned accounts.I have two tables
1) users -For all users
2) banusers -For all ban users.

So,i want select all banned users( From table 'BanUsers' and delete then delete their account from table 'Users' )



For delete:
Код:
DELETE FROM `users` WHERE 'Name' = '?'
For Select all ban users
Код:
SELECT Name FROM `banusers`
I don't know to finish..
Reply
#2

The first query will delete the user completely.. What you need is to UPDATE users and set the column to not banned.

So basically, an example:
pawn Код:
UPDATE users SET banned=0 WHERE banned=1;
DELETE FROM banusers;
The first query depends on your table structure.
Reply
#3

I want to delete the user completely...
And I have two tables..I need to load all banned accounts from 'banusers' and then delete their accounts in 'user' table..
Reply
#4

OK, I misunderstood. You need to join them. Again, I can only give examples as you do not post your database structure.
pawn Код:
DELETE FROM users u
INNER JOIN banusers bu ON bu.name=u.name;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)