Article View: es.comp.os.linux.programacion
Article #7726Re: Pregunta sobre mySQL. Operador AND
From: Helio.es
Date: Tue, 11 Feb 2003 11:40
Date: Tue, 11 Feb 2003 11:40
54 lines
2501 bytes
2501 bytes
Pon solo un &
0 & 1 = 0
1 & 1 = 1
2 &1 = 0
3 & 1 = 0
en http://www.mysql.com/doc/en/Bit_functions.html dice:
The result is an unsigned 64-bit integer.
&
Bitwise AND
mysql> SELECT 29 & 15;
-> 13
y tu ten�as (en http://www.mysql.com/doc/en/Logical_Operators.html):
The last example produces 1 because the expression evaluates the same
way as (!1)+1. AND && Logical AND. Evaluates to 1 if all operands are
non-zero and not NULL, to 0 if one or more operands are 0, otherwise
NULL is returned. mysql> SELECT 1 && 1;
-> 1
mysql> SELECT 1 && 0;
-> 0
mysql> SELECT 1 && NULL;
-> NULL
mysql> SELECT 0 && NULL;
-> 0
mysql> SELECT NULL && 0;
-> 0
"sio2" <auxiliar@inwind.it> escribi� en el mensaje
news:1b5b7a1f.0302110315.5b6e70f3@posting.google.com...
> �Es posible en mysql hacer la operaci�n AND con n�meros (aunque se
llame
> de otra forma? Es decir que:
>
> 0 && 1 = 0
> 1 && 1 = 1
> 2 && 1 = 0
> 3 && 1 = 1
> etc...
>
> por ejemplo. Resulta que he hecho una base de datos con la esperanza
(me
> pareci� leerlo en el manual) de que esta operaci�n se pod�a hacer y
ahora
> resulta que solo veo que el AND es un operador l�gico simpl�n que no
hace
> operaciones con n�meros (puestos en binario, quiero decir).
>
> Hice el atributo con la intenci�n de que recogiese unas cuantas
> caracter�sticas que pod�an ser 's�' o 'no' de modo que luego con la
> operaci�n binaria pod�a saber si tal registro la ten�a o no.
Technical Details
Message-ID:
<b2ang5$1aeds6$1@ID-165255.news.dfncis.de>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!80-25-0-142.uc.nombres.ttd.ES!not-for-mailReferences:
<1b5b7a1f.0302110315.5b6e70f3@posting.google.com>Show Full Headers
Complete Article Headers
X-Google-Language: SPANISH,ASCII X-Google-Thread: f86c8,2edea6dd320d9ea3 X-Google-Attributes: gidf86c8,public X-Google-ArrivalTime: 2003-02-11 03:40:55 PST Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fu-berlin.de!uni-berlin.de!80-25-0-142.uc.nombres.ttd.ES!not-for-mail From: "Helio.es" <nospam_heltena@hotmail.com> Newsgroups: es.comp.os.linux.programacion Subject: Re: Pregunta sobre mySQL. Operador AND Date: Tue, 11 Feb 2003 12:40:55 +0100 Lines: 56 Message-ID: <b2ang5$1aeds6$1@ID-165255.news.dfncis.de> References: <1b5b7a1f.0302110315.5b6e70f3@posting.google.com> NNTP-Posting-Host: 80-25-0-142.uc.nombres.ttd.es (80.25.0.142) X-Trace: fu-berlin.de 1044963653 44513158 80.25.0.142 (16 [165255]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2720.3000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000