X-Original-To: pgsql-php-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 3716BD1B449 for ; Sun, 21 Dec 2003 01:53:46 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 41605-01 for ; Sat, 20 Dec 2003 21:52:59 -0400 (AST) Received: from quality.qadas.com (quality.qadas.com [204.227.16.4]) by svr1.postgresql.org (Postfix) with ESMTP id C8AEFD1B43E for ; Sat, 20 Dec 2003 21:52:55 -0400 (AST) Received: from quality.qadas.com (localhost [127.0.0.1]) by quality.qadas.com (8.12.10/8.12.10) with ESMTP id hBL1qwln018248; Sat, 20 Dec 2003 18:52:58 -0700 (MST) Received: (from mfuhr@localhost) by quality.qadas.com (8.12.10/8.12.10/Submit) id hBL1qnOH018193; Sat, 20 Dec 2003 18:52:49 -0700 (MST) Date: Sat, 20 Dec 2003 18:52:49 -0700 From: Michael Fuhr To: "Seader, Cameron" Cc: pgsql-php@postgresql.org Subject: Re: PostgreSQL and Bitwise and with int8 field Message-ID: <20031220185249.A12953@quality.qadas.com> References: <71B8A8BEC516CF46835CA629156CF211103813@bedford.idacorp.local> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <71B8A8BEC516CF46835CA629156CF211103813@bedford.idacorp.local>; from CSeader@idahopower.com on Sat, Dec 20, 2003 at 02:44:31PM -0700 X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200312/55 X-Sequence-Number: 2501 On Sat, Dec 20, 2003 at 02:44:31PM -0700, Seader, Cameron wrote: > I am trying to get the proper output with this SQL statement: > > SELECT *, (highalarm & 0xffffffff)as high1, (highalarm >> 32)as high2 FROM t444d500009b5_2_6 ORDER BY utctime DESC LIMIT 1 Try this: SELECT *, (highalarm & x'ffffffff'::int8) AS high1, (highalarm >> 32) AS high2 FROM t444d500009b5_2_6 ORDER BY utctime DESC LIMIT 1 -- Michael Fuhr http://www.fuhr.org/~mfuhr/