#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2004
    Posts
    58
    Rep Power
    10

    AND All BIN Rows


    I was hope to be able to move part of my code into the DB, but I am not sure if it is possible.

    If I do

    SELECT BIN(Small Int Column) FROM table

    then I get a list of BIN values

    Is there a function like SUM for decimal numbers, but for binary that will AND the rows together and give one value

    I mean if for example if i Have

    000
    001
    010
    011

    returned

    Is there a function like

    SELECT AND(BIN(column)) and in the case above it would return 011 as it is the AND value of all the rows returned

    Graham
  2. #2
  3. SQL Consultant
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2003
    Location
    Toronto Canada
    Posts
    27,209
    Rep Power
    4279
    i don't think there is an aggregate AND function, sorry

    too bad you decided to use binary

    any chance you can change it?
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

IMN logo majestic logo threadwatch logo seochat tools logo