On 10-Aug-2001 [EMAIL PROTECTED] wrote:
> Hi,
>
> Whats the most efficient way of doing a SELECT ... IN on a field of
> datatype 'SET' ?
>
> Say you have four types of 'permissions':
> - superuser
> - poweruser
> - normal
> - guest
>
> Each user has a field, permissions, of type SET
> ("superuser","poweruser","normal","guest");
> Each "resource" has a field, "AllowAccessIf", as above
>
> Now I need to
> SELECT this,that,theother FROM table WHERE permissions IN
> ("superuser","poweruser","normal","guest");
>
> his works fine if permissions is only one value, eg "superuser"
> OR "poweruser", etc. However, if the user is "superuser,normal", then
> ofcourse, it wont match...
>
> How do I get around this? I'd prefer NOT to have to have a separate table
> of 'permission types' or roles etc, as I feel this would slow the process
> down, and also complicate adding, modifying and removing "users"
> and "resources".
>
> I'd prefer not to just have to go like IN
> ("superuser,powersuer,normal", "superuser,poweruser", "superuser,normal",
> "normal,guest", "guest,superuser", "poweruser.......)
>
You could use the numeric value: "select ... WHERE permissions|0 in (1,3) ..."
> (The example is kinda simplified so that the question was)...
Ya, "guest,superuser" burrr...
Regards,
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php