【问题标题】:Bitwise operators in PostgresPostgres 中的位运算符
【发布时间】:2010-11-15 09:17:37
【问题描述】:

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

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

我的查询如下所示

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

任何帮助将不胜感激

【问题讨论】:

    标签: sql mysql postgresql


    【解决方案1】:

    您需要进行比较:

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

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-09-06
      • 1970-01-01
      • 2021-05-14
      • 2012-11-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多