Re: comparacion defechas mysql

From: Date: Fri, 02 Feb 2001 18:21:19 +0000
Subject: Re: comparacion defechas mysql
References: 1  Groups: php.general.es 
Request: Send a blank email to general-es+get-6703@lists.php.net to get a copy of this message
Creo deberas utilizar: select hid,thetext from horoscope WHERE (bdate BETWEEN fecha1 AND fecha2) ; Bye. Eduardo Garcia wrote: > > Hola lista tengo la siguiente tabla> > > CREATE TABLE horoscope ( > hid int(10) unsigned NOT NULL auto_increment, > name varchar(50), > thetext text, > bdate timestamp(6) DEFAULT '00-00-00' NOT NULL, > edate timestamp(6) DEFAULT '00-00-00' NOT NULL, > PRIMARY KEY (hid) > ); > > con los siguientes registros": > > insert into horoscope > values(NULL,"Acuario","","000121","000219"); > insert into horoscope > values(NULL,"Piscis","","000220","000321"); > insert into horoscope > values(NULL,"Aries","","000322","000420"); > insert into horoscope > values(NULL,"Tauro","","000421","000521"); > insert into horoscope > values(NULL,"Geminis","","000522","000622"); > insert into horoscope > values(NULL,"Cancer","","000623","000723"); > insert into horoscope > values(NULL,"Leo","","000724","000823"); > insert into horoscope > values(NULL,"Virgo","","000824","000923"); > insert into horoscope > values(NULL,"Libra","","000924","001023"); > insert into horoscope > values(NULL,"Escorpion","","001024","001122"); > insert into horoscope > values(NULL,"Sagitario","","001123","001222"); > insert into horoscope > values(NULL,"Capricornio","","001223","000120"); > > y la siguiente consulta: > > select hid,thetext from horoscope where bdate <= 000202 and edate >= 000202; > > Bajo mi logica deberia devolver Piscis, pero no devuelve Acuario que podra > ser. > > gracias por todo. > > enzo > Eduardo Garcia > Cel: 6585836 > Icq: 69885612 > Santa Marta - Magdalena > Colombia - Sur America > Usuario Linux # 164529 > > ____________________________________________________________________ > Get free email and a permanent address at > http://www.netaddress.com/?N=1 > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > Manual PHP en español: http://www.php.net/manual/es/ > Para dar de baja la suscripción, mande un mensaje a: > lista-unsubscribe@phpes.com

« previous php.general.es (#6703) next »