grouping on a bit

  • I think I'm reaching my quota for questions on the week but I'll press onwards regardless.

    I am trying to select records from a joined result set. I have a 'group by' that contains all of the columns

    My query is returning two records and I realized that it is because one row has a bit 1 and another has a bit 0.

    It may be invalid data since everything else matches but I need to consolidate this into one record.

    How can I test the bit column and return only 1 result?

    figuring that true/true=true, true/false=false, false/false=false

    kinda hard to do a google search when you're going off words like bit, true, false or group :/

    Thanks,

    Chris

  • Select MIN(BitColumn) and don't put it in the group by...

     

    if any row is false then all rows will return false, if all rows are true, then return true.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply