PDA

View Full Version : SQL Query : Mass move specific users based on usernames, not userid


flyguye
05 Apr 2012, 10:21
Hi,

I need to mass move specific users (a couple of hundred of them) based on their usernames, not based on their id, to be deleted at a later time.

Each user is unique, with differing post counts, join dates, etc.

I've tried to mess around with some SQL queries but no luck.



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



I have the usernames on excel so if I could add them into the query either comma separated, or space separated, or line separated would be great! :up:

I've no knowledge on SQL, so I might be shootin' in the dark here! :confused:

Pandemikk
05 Apr 2012, 10:24
Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------



Only problem is you have to make sure the username's are escaped. Feel free to PM me a list of the username's and I'll write up a quick script that'll get the job done.

flyguye
05 Apr 2012, 10:49
Very kind of you sir! However the list isn't finalized yet, will PM you the list once it's finalized!

However, I don't understand what you mean by the usernames being escaped?

--------------- Added 1333624292 at 1333624292 ---------------

Managed to do it!

I used excel to add the 'apostrophes' and appropriate spaces at the end of each username, and pasted it in the following format:



Code:
---------------
Code is only visible to licensed users, and only when logged into the forums.
---------------


Where X is the target usergroupid

That allowed me to paste the all the usernames at one go!

Thanks again! :up: SOLVED!

Pandemikk
05 Apr 2012, 14:17
By escaped, I mean there are certain characters in usernames that would break the query, most notably an apostrophe itself. But seeing as how everything worked out I'm going to assume none of the username's had an apostrophe in them, anyway. ;)

Glad I could be of assistance. :D