Applying the MIN aggregate function to a BIT field

前端 未结 7 538
甜味超标
甜味超标 2020-12-05 01:36

I want to write the following query:

SELECT   ..., MIN(SomeBitField), ...
FROM     ...
WHERE    ...
GROUP BY ...

The problem is, SQL Ser

7条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-05 02:17

    select min(convert(int, somebitfield))
    

    or if you want to keep result as bit

    select convert(bit, min(convert(int, somebitfield)))
    

提交回复
热议问题