1
Good afternoon, What could be wrong in my query that is returning empty because of the date condition. Follows query:
SELECT
imp_loja AS LOJA,
imp_item AS ITEM,
imp_desc AS DESCRICAO,
imp_dias_giro AS DIAS_DE_GIRO,
imp_nec AS NECESSIDADE,
imp_pedido AS PEDIDO,
imp_bancao AS BANCAO,
imp_romaneio AS ROMANEIO,
imp_transito AS TRANSITO,
imp_gondola AS GONDOLA,
imp_fator AS FATOR,
imp_reposicao AS REPOSICAO,
imp_estoque AS ESTOQUE,
imp_estoque_dc AS EST_DC,
(imp_nec - imp_fator) AS NEC_FAT,
(imp_estoque / imp_fator) AS EXT_X_FATOR,
(imp_estoque + imp_transito) AS ESTTRAN,
(imp_nec - imp_fator) AS NECFAT,
imp_data AS DATA
FROM importacao WHERE imp_data = NOW()
ORDER BY imp_desc
Follows the table:
# Host: localhost (Version 5.5.5-10.1.13-MariaDB)
# Date: 2016-06-23 15:57:02
# Generator: MySQL-Front 5.3 (Build 5.33)
/*!40101 SET NAMES utf8 */;
#
# Structure for table "importacao"
#
CREATE TABLE `importacao` (
`imp_loja` int(11) DEFAULT NULL,
`imp_item` int(11) DEFAULT NULL,
`imp_desc` varchar(254) DEFAULT NULL,
`imp_obs` varchar(50) DEFAULT NULL,
`imp_dias_venda` int(11) DEFAULT NULL,
`imp_dias_giro` int(11) DEFAULT NULL,
`imp_nec` int(11) DEFAULT NULL,
`imp_pedido` int(11) DEFAULT NULL,
`imp_bancao` int(11) DEFAULT NULL,
`imp_romaneio` int(11) DEFAULT NULL,
`imp_transito` int(11) DEFAULT NULL,
`imp_gondola` int(11) DEFAULT NULL,
`imp_fator` int(11) DEFAULT NULL,
`imp_reposicao` int(11) DEFAULT NULL,
`imp_estoque` int(11) DEFAULT NULL,
`imp_estoque_dc` int(11) DEFAULT NULL,
`imp_id` int(11) NOT NULL AUTO_INCREMENT,
`imp_data` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (`imp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
#
# Data for table "importacao"
#
Obs: I’ve tried to:
CURRENT_TIMESTAMP()
CURDATE()
NOW()
Probably the hour/minute of the
now()
should not hit the stored value, if comparing only the date, make a cast to date of both values. Only confirm if you need date or date and time.– rray
rray, do not know the caste could give me an example , please ?
– Chefe Druida