Re: [SOLVED] SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?

From: Ozz Nixon <ozznixon(at)gmail(dot)com>
To: Ozz Nixon <ozznixon(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: [SOLVED] SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?
Date: 2010-03-03 01:59:39
Message-ID: BD785161-4C14-4088-AAD5-CD0679043182@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Figured it out:

./sql -S=10.1.10.232
PostgreSQL v8.x Compatible SQL Command Line Tool by 3F, LLC (www.3flabs.com
)

SQL> select * from bffcomwiki where flags & 8 != 0;
pagename
=
=
=
=
=
=
========================================================================
Welcome

1 records found in 3.00 ms.

SQL>

On Mar 2, 2010, at 8:30 PM, Ozz Nixon wrote:

> I do not know how to really describe this...
>
> In pascal I would do
>
> If (AField and Flag3)=Flag3 then ...
>
> Checking to see if AField contains the BIT(s) FLAG3 is set to... is
> there a way to do this in a SELECT statement -- select * from ATable
> where AField and 0x0004=0x0004
>
> ?
>
> Thanks,
> O.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 2010-03-03 03:34:30 Re: [GENERAL] to_timestamp() and quarters
Previous Message Ozz Nixon 2010-03-03 01:30:30 SQL Syntax - like FIELD and BITPATTERN = BITPATTERN?