8 messages in com.mysql.lists.mysql-esRE: orden y comparaciones con una col...| From | Sent On | Attachments |
|---|---|---|
| cami...@gmail.com | 09 Apr 2008 08:39 | |
| ewen fortune | 09 Apr 2008 10:06 | |
| cami...@gmail.com | 09 Apr 2008 10:36 | |
| Thomas Goik - auxion.de | 09 Apr 2008 12:08 | |
| cami...@gmail.com | 09 Apr 2008 12:23 | |
| cami...@gmail.com | 09 Apr 2008 16:14 | |
| Thomas Goik - auxion.de | 09 Apr 2008 23:45 | |
| cami...@gmail.com | 15 Apr 2008 12:06 |
| Subject: | RE: orden y comparaciones con una columna TIME![]() |
|---|---|
| From: | Thomas Goik - auxion.de (tech...@auxion.de) |
| Date: | 04/09/2008 12:08:53 PM |
| List: | com.mysql.lists.mysql-es |
Hola;
Primero deberías cambiar el diseño de tu table, al menos que se refiera a los índices Dices que haces order by on beginning y where en ending, pero no las tienes en tus inidices
Al menos puedes hacer key(beginning, ending)
Sobre tu order by timefield, puedes intentar que mysql lo interpreta como un numero usando
SELECT ... order by timefield+0 ASC;
Acerca de tu 2° problema pienso que sea mas coherente de cambiar el diseño de tu table, ya que te sea mucho mas fácil usar Datetime, timestamp o unix_timestamp as integer con dichas SELECT.
Como en un campo datetime puedes usar el date_format y similares. Asi que no será problema de capturar simplemente el tiempo en horas, minutes y segundos SELECT date_format(beginning,'%t') as start_time, date_format(ending,'%t') as end_time FROM ... order by beginning ASC
No me acuerdo del todo si era date_format(campo_datetime,'%t') o date_format('%t', campo_datetime)
Mit freundlichen Grüssen Thomas Goik
-- Lofox GmbH Geschäftsführerin: Evelyn Fuchs Im Kamperholz 48 44805 Bochum - Germany Amtsgericht Bochum HRB 7042 USt-IdNr.: DE215698227 St.-Nr. Bochum 306/5885/0172
-----Mensaje original----- De: cami...@gmail.com [mailto:cami...@gmail.com] Enviado el: Mittwoch, 9. April 2008 19:37 Para: ewen fortune CC: mysq...@lists.mysql.com Asunto: Re: orden y comparaciones con una columna TIME
Hola,
On 09/04/2008, ewen fortune <ewen...@gmail.com> wrote:
Hola, Puedes desvelar un poco más sobre la tabla y los select?. Quizas con un "show create table programas"
Te paso el show create table, aunque los datos del mail inicial están acotados al problema para no abundar demasiado y no sé si servirá de mucho:
CREATE TABLE `program` ( `id` int(11) NOT NULL auto_increment, `title` varchar(250) NOT NULL default '', `alias` varchar(250) NOT NULL default '', `description` text NOT NULL, `text` text NOT NULL, `text_format` set('html','bbcode','plain') NOT NULL, `image` set('jpg','gif','png') default NULL, `epigraph` varchar(250) NOT NULL, `published` tinyint(1) NOT NULL, `station_id` int(11) NOT NULL, `day0` smallint(1) NOT NULL default '0', `day1` smallint(1) NOT NULL default '0', `day2` smallint(1) NOT NULL default '0', `day3` smallint(1) NOT NULL default '0', `day4` smallint(1) NOT NULL default '0', `day5` smallint(1) NOT NULL default '0', `day6` smallint(1) NOT NULL default '0', `beginning` time NOT NULL default '00:00:00', `ending` time NOT NULL default '00:00:00', `manager_id` int(11) NOT NULL, PRIMARY KEY (`id`), KEY `day6` (`day6`), KEY `day5` (`day5`), KEY `day4` (`day4`), KEY `day3` (`day3`), KEY `day2` (`day2`), KEY `day1` (`day1`), KEY `day0` (`day0`), KEY `manager_id` (`manager_id`), KEY `station_id` (`station_id`) ) ENGINE=MyISAM AUTO_INCREMENT=1 DEFAULT CHARSET=utf8
saludos y gracias desde ya
-- Prof. Camilo Kawerín Technology Director
Pandemia Digital www.pandemiadigital.com




