![]() |
MySQL problem: select a user where membergroupids = 5,7
I want to select a list of users that have a certain membergroupid
Code:
SELECT username So how can I make sure I also select those with multiple usergroups? --------------- Added [DATE]1201523929[/DATE] at [TIME]1201523929[/TIME] --------------- @the one that posted a reply earlier: This selects it only if the membergroupids start with 5. But it helped me, I've added everyone to the registered members group, and expanded it to WHERE membergroupids IN (2 , 5 , 7 ) Thank you. |
That still isn't going to help you when the membergroupids is more than one. The mysql function you want is find_in_set
[mysql] select username from user where find_in_set('9',membergroupids) [/mysql] The main issue is this query is in no way optimised to use indices, and will do a full table scan. |
What is the difference between find_in_set and this:
Code:
SELECT username |
You are going to get 29, 92, etc.
|
All times are GMT. The time now is 01:33 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|