Re: Logic AND between some strings

Поиск
Список
Период
Сортировка
От Bill Thoen
Тема Re: Logic AND between some strings
Дата
Msg-id 4D7532DE.1070701@gisnet.com
обсуждение исходный текст
Ответ на Logic AND between some strings  (yagru_alvarez <jmalvarez@estudiantes.uci.cu>)
Список pgsql-general
Just to make sure, you're asking for the logical AND, not the bitwise
AND? In other words you're not talking about getting into bit shifting
with << and >> and masking with &?

For the logical AND, you need to use expressions that evaluate to TRUE
or FALSE, and follow the rules in this "truth table":

Expr 1    Expr 2     AND returns
true        true         true
true        false        false
false       true         false
false       false        false

like 01100010 == 00001100 AND 01100010 > 00001100 would evaluate to
false AND true (depending on how you interpret these bitstrings), and so
that evaluates to false. If you're dealing with bitstrings (text made up
of only zeros and ones), then I'd implement this by just using text
comparisions, since bitstrings are just text and have the same
comparision behavior as the unsigned integers  they could represent.





On 3/7/2011 7:25 AM, yagru_alvarez wrote:
> I want to make a Logic AND between some strings of 0s and 1s .. Here
> you have an example:
>
> 1->  01100010
> 2->  00001100
>
> I wanto to make a LOGIC AND between 01100010 and 00001100.
>
> I' m working with C++, I need some code to have an idea about how I
> can perform that.
>


В списке pgsql-general по дате отправления:

Предыдущее
От: "David Johnston"
Дата:
Сообщение: Re: Understanding of LOCK and pg_sleep interaction
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Why count(*) doest use index?