Results 1 to 2 of 2

Thread: Max of Bit sort of

  1. #1

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339

    Max of Bit sort of

    I have a usergroup table that has a bunch of bit values for each options in it. I was trying to think what to do if a user belongs to more than one group and I was wondering how I could write a query or stored procedure that gives me the The True statement in each option?

    Data like this:
    GROUPNAME,HIRE,TERM,PAYROLL, CASH
    Admin,True (1),True (1),True (1), True (1)
    Guest,True (1), False (0), False (0), True (1)
    Standard, True (1), True (1),False (0), False (0)

    Now what I want is lets say a user belongs to Guest and Standard then it should return:
    Combined,True (1), True (1), False (0), True (1)

    Can this be done in SQL? Or should I just get the values and work the rest out in code?

  2. #2

    Thread Starter
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well I don't know if this is the best way or not but I found that I could convert each bit value to an int and then use MAX() and that worked.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width