Postgres中的按位运算符

时间:2009-07-30 09:38:32

标签: sql mysql postgresql

我在Postgres中使用Bitwise运算符时遇到问题我收到以下错误消息

ERROR:  argument of WHERE must be type boolean, not type integer

我的查询如下所示

SELECT DISTINCT number,name,contact,special FROM clients WHERE special & 2048;

任何帮助将不胜感激

1 个答案:

答案 0 :(得分:24)

您需要进行比较:

SELECT DISTINCT number, ..., special FROM clients WHERE special & 2048 = 2048;

SELECT DISTINCT number, ..., special FROM clients WHERE special & 2048 > 0;