Ver Mensaje Individual
  #3 (permalink)  
Antiguo 03/01/2015, 07:37
cordobespolo
 
Fecha de Ingreso: septiembre-2014
Mensajes: 5
Antigüedad: 9 años, 8 meses
Puntos: 0
Respuesta: Consulta Fecha Mysql

Gracias por tu rápida respuesta,

He echo la consulta tal y como me has indicado y ahora no me arroja ningún resultado.
También he cambiado el varchar de la tabla por date.

La estructura de la tabla es:

Código MySQL:
Ver original
  1. SET FOREIGN_KEY_CHECKS=0;
  2. -- ----------------------------
  3. -- Table structure for tblevento
  4. -- ----------------------------
  5. DROP TABLE IF EXISTS `tblevento`;
  6. CREATE TABLE `tblevento` (
  7.   `idEvento` int(11) NOT NULL AUTO_INCREMENT,
  8.   `intLugar` int(11) DEFAULT NULL,
  9.   `intJugadores` int(11) DEFAULT NULL,
  10.   `intNivel` int(11) DEFAULT NULL,
  11.   `intUsuario` int(11) DEFAULT NULL,
  12.   `dbPrecio` double(11,2) DEFAULT NULL,
  13.   `intProvincia` int(11) DEFAULT NULL,
  14.   `intDeporte` int(11) DEFAULT NULL,
  15.   `strFecha` date DEFAULT NULL,
  16.   PRIMARY KEY (`idEvento`)
  17. ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1 COLLATE=latin1_spanish_ci;
  18.  
  19. -- ----------------------------
  20. -- Records
  21. -- ----------------------------
  22. INSERT INTO `tblevento` VALUES ('1', '655', '8', '1', '7', '0.00', '19', '1', '2015-01-31');

y la consulta que he realizado es:

Código MySQL:
Ver original
  1. SELECT * FROM tblevento
  2. WHERE intProvincia = 19
  3.     AND intDeporte = 1
  4.     AND STR_TO_DATE(strFecha,'%Y-%m-%d') = STR_TO_DATE('2015-01-31','%Y-%m-%d')
  5. ORDER BY strHora ASC

No se que es lo que puede pasar, gracias de antemano

Última edición por gnzsoloyo; 03/01/2015 a las 08:49 Razón: MUY MAL etiquetado... Usar Highlight "SQL" o "MySQL".