PDA

View Full Version : Quick writing


ManagerJosh
Sat 18th Dec '04, 6:00pm
I pruned a bunch of users off my vB database, but realized I forgot to update a script, so it didn't prune a mirror database.

So wanting to write a quick script to see how I can accomplish this...but can't figure out at the moment...aahaha

I know this...

Select UserId from AltDatabase
Select UserID from vBulletin Database


If UserID from AltDatabase Exist In UserID From vBulletin Database -> Skip, Move On
If UserID from AltDatabase !Exist in UserID from vBulletin Database -> Remove Entry

Suggestions on how to accomplish this? :)

ManagerJosh
Tue 21st Dec '04, 5:07am
Bump? :)

Kier
Tue 21st Dec '04, 8:51am
To find the users who exist in mirrordb but not in masterdb:

SELECT db2.user.userid
FROM mirrordb AS db2
LEFT JOIN masterdb AS db1 ON(db1.user.userid = db2.user.userid)
WHERE db1.user.userid IS NULL

This will return a list of userids, which you can then stick into a delete query to run against the various user tables in the mirror database.