Sum Bit Fields?

databasedonr

Registered User.
Local time
Today, 06:29
Joined
Feb 13, 2003
Messages
163
I have a table with seven bit fields, and I want to select the records where the total of all the bit fields is greater than 3. Is this possible?

Thanks.
 
How about showing readers a bit of your code to help with your set up?
 
Good catch plog.
 
Access vs SQL Server. This works great in Access but does not translate to SQL Server.
 
My test shows that you can add Yes/No fields just like described in that post. What exactly is happening in Access? Error, incorrect results, etc?
 
It's was working fine in Access, which was one case I had - I tried the same solution in SQL Server, which did not work. I was able to solve it by flipping the values in SQL and adding them, like this:

(CASE WHEN bool1 = -1 then 1 else 0 end) + (Case WHEN bool2 = -1 then 1 else 0 end) ... and so on.

Thanks for looking, I have it working.

I can post the final SQL Server query if anyone wants to see it.
 

Users who are viewing this thread

Back
Top Bottom