MyBB Community Forums

Full Version: Query for list of active user ID's?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Sorry if this isn't the right forum, but it has nothing to do with a plugin, so I put it here.

Can any of you that are good with MySql let me know if there is a query I can run that will give me a list of User ID's that have a username attached to it? I hope that makes sense? For example, I have had almost 500 people register, but only have about 250 members...so we're talking about almost that amount in members that I've deleted. There's no way to reuse those numbers, so they will always be invalid. So I was just hoping there was an easy way (a query) to get a list of those ID's that ARE valid.

Thanks in advance! Big Grin
Once a unique key in a table is used in MySQL it will never be used again, a new record (new member), will always have a number that isn't used before. So you want a list of current used UID's ?

SELECT uid FROM `mybb_users`
It would be possible if you really wanted to but due to the nature of a relational database you would have to do a lot of manual re-referencing and the chances of the whole thing working again afterwards are slim.

Missing numbers are no worry and don't take up any space anyway.

Since members are removed from the table when deleted, this query will list all your current users (UID and Username).
SELECT uid, username FROM {your_prefix}users
Thanks guys! Both of those might come in handy! Big Grin