Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I use 'GROUP BY' on a 'bit' -column?

Status
Not open for further replies.

jonash

Technical User
Jun 26, 2001
1
SE
When I use GROUP BY on a 'bit' -column I get an errormessage. Is this a possible statement? Can I do this any other way?
 
some possible solution:

select count(*)
from
(select a,b, cast(someBitCol as int) x) t
group by t.x John Fill
1c.bmp


ivfmd@mail.md
 
Hi jonash,

You can use this also,
select case mybitfld when 1 then 1 else 0 end as mybitfld,
myOtherColumns...
from myTable
group by case mybitfld when 1 then 1 else 0 end,
myOtherColumns...


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top