Re: bit operations

From: merlyn(at)stonehenge(dot)com (Randal L(dot) Schwartz)
To: Oliver Vecernik <vecernik(at)aon(dot)at>
Cc: Johan Björk <johan(at)websidorna(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: bit operations
Date: 2001-07-04 17:09:21
Message-ID: m1d77gzkn2.fsf@halfdome.holdit.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>>>>> "Oliver" == Oliver Vecernik <vecernik(at)aon(dot)at> writes:

>> Say I wanna check if 8 (1xxx) and 2 (xx1x) is set, how do I do that?!

Oliver> Sorry, I didn't read the whole question first:

Oliver> select * from table where ((flags & 8) <> 0) and ((flags & 2) <> 0);

In the old days, we spelled that as flags & 10 = 10. :) Wouldn't that
work just as well?

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn(at)stonehenge(dot)com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jeff Rhys-Jones 2001-07-04 17:27:07 Inner Join?
Previous Message Chuck Shunk 2001-07-04 17:05:05 Remote queries