Re: OT: Como sumar horas en SQL MySQL

From: Date: Tue, 11 Nov 2003 07:09:09 +0000
Subject: Re: OT: Como sumar horas en SQL MySQL
References: 1 2  Groups: php.general.es 
Request: Send a blank email to general-es+get-42391@lists.php.net to get a copy of this message
$tempo=explode(":",$row[tiempo]); la tienes que substituir por: $tiempo=explode(":",$row[tiempo]); Me havia dejado la "i" en la variable. Josep Ma. Aribau Cano ----- Original Message ----- From: "jm aribau" <jm@infodos.com> To: <lista@phpes.com> Sent: Tuesday, November 11, 2003 7:50 AM Subject: Re: [PHP-ES] OT: Como sumar horas en SQL MySQL > Una manera de hacerlo mediante php podria ser: > > $sql= "select tiempo from bitacora where idpiloto=3"; > while ( $row = mysql_fetch_array(mysql_query($sql))) { > $tempo=explode(":",$row[tiempo]); > $minutos = $minutos + $tiempo[1]; > $horas = $horas + $tiempo[0]; > } > $horas = $horas + ($minutos / 60); > $minutos = $minutos % 60; > > Espero haberte ayudado- > > Josep Ma. Aribau Cano > > > ----- Original Message ----- > From: "P.A. Luis Tena O." <ltena@gmx.net> > To: <lista@phpes.com> > Sent: Tuesday, November 11, 2003 6:47 AM > Subject: [PHP-ES] OT: Como sumar horas en SQL MySQL > > > Hola gente, un favor, como puedo sumar horas desde un SQL? Tengo una > tabla llamada bitácora la cual registra las horas de vuelo de pilotos, > en la tabla hay un campo llamado tiempo que es le tiempo de vuelo y esta > definido como tipo TIME 00:00:00 ahora, como le podria hacer para sumar > las horas de esa columna? O por PHP? > > Algo asi como select sum(tiempo) from bitácora > > Pero no funciona me regresa un integer y no algo parecido a un formato > de hora. > > Estoy usando MySQL 3.23.54 > > Row1: 1:15 > Row2: 1:15 > Row3: 34:30 > > Eso daria un total de 37:00 Hrs. > > Gracias de antemano por la ayuda > ------------------------------------------ > P.A. Luis Tena O. > México D.F. > UIN: 4287383 > MS Messenger: cookieme@usa.net > ------------------------------------------------ > El contenido de este mensaje de datos es confidencial y se entiende > dirigido y para uso exclusivo del destinatario. Si usted no es el > destinatario, se le prohíbe su utilización total o parcial para > cualquier fin. > > The content of this data transmission is confidential and it is intended > to be delivered only to the addresses, therefore, it shall not be > distributed and/or disclosed through any mean without the original > sender's previous authorization. > > If you are not the addressee you are forbidden to use it, either totally > or partially, for any purpose. > > > > > --------------------------------------------------------------------- > Archivo On-line: http://www.phpes.com/ > via news: news://news.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 (#42391) next »