par
orgerix » 22 déc. 2009, 21:16
Structure de la table
CREATE TABLE IF NOT EXISTS `interv` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`salle` varchar(32) NOT NULL,
`HAUS` time DEFAULT NULL,
`HEB` time DEFAULT NULL,
`HES` time DEFAULT NULL,
`HIN` time DEFAULT NULL,
`HIC` time DEFAULT NULL,
`HFI` time DEFAULT NULL,
`HSS` time DEFAULT NULL,
`HESSPI` time DEFAULT NULL,
`HSSSPI` time DEFAULT NULL,
`PROG` varchar(32) DEFAULT NULL,
`CHIRURGIEN` varchar(32) DEFAULT NULL,
`ANES` varchar(32) DEFAULT NULL,
`TYPE` varchar(32) DEFAULT NULL,
`IBODE` int(16) DEFAULT NULL,
`IADE` int(16) DEFAULT NULL,
`raz` enum('court','moyen','long') DEFAULT 'moyen',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
Bonjour,
J'aimerai, par jour et par salle, obtenir l'enregistrement qui correspond au plus petit HES. Lorsque je n'avais besoin que de HES, j'ai pu m'en sortir ainsi :
SELECT date,salle,MIN(HES) FROM interv GROUP BY date,salle
Cependant, j'ai besoin de connaitre la valeur de raz correspondant à l'enregistrement ou se trouve le HES minimum.
Petit exemple (désolé pour la présentation, j'arrive pas à faire de tableau...)
Date Salle HES raz
01/01/2009 1 12:00:00 moyen
01/01/2009 1 07:00:00 long
01/01/2009 1 18:00:00 court
J'aimerai obtenir, avec une methode marchant pour plusieurs jours et plusieurs salles
01/01/2009 1 07:00:00 long
Structure de la table
[sql]
CREATE TABLE IF NOT EXISTS `interv` (
`id` int(16) NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`salle` varchar(32) NOT NULL,
`HAUS` time DEFAULT NULL,
`HEB` time DEFAULT NULL,
`HES` time DEFAULT NULL,
`HIN` time DEFAULT NULL,
`HIC` time DEFAULT NULL,
`HFI` time DEFAULT NULL,
`HSS` time DEFAULT NULL,
`HESSPI` time DEFAULT NULL,
`HSSSPI` time DEFAULT NULL,
`PROG` varchar(32) DEFAULT NULL,
`CHIRURGIEN` varchar(32) DEFAULT NULL,
`ANES` varchar(32) DEFAULT NULL,
`TYPE` varchar(32) DEFAULT NULL,
`IBODE` int(16) DEFAULT NULL,
`IADE` int(16) DEFAULT NULL,
`raz` enum('court','moyen','long') DEFAULT 'moyen',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1[/sql]
Bonjour,
J'aimerai, par jour et par salle, obtenir l'enregistrement qui correspond au plus petit HES. Lorsque je n'avais besoin que de HES, j'ai pu m'en sortir ainsi :
[sql]SELECT date,salle,MIN(HES) FROM interv GROUP BY date,salle[/sql]
Cependant, j'ai besoin de connaitre la valeur de raz correspondant à l'enregistrement ou se trouve le HES minimum.
Petit exemple (désolé pour la présentation, j'arrive pas à faire de tableau...)
Date Salle HES raz
01/01/2009 1 12:00:00 moyen
01/01/2009 1 07:00:00 long
01/01/2009 1 18:00:00 court
J'aimerai obtenir, avec une methode marchant pour plusieurs jours et plusieurs salles
01/01/2009 1 07:00:00 long