Query a field formatted datetime year to second, asking to bring only today's records?

0

I would like to know how to fetch a date record, but bring this dat_entrada only with the current date? Here is the query:

select
   a1.cdg_filial Filial,
   a1.cdg_fornecedor Fornecedor,
   a2.dcr_fornecedor NomeFornecedor,
   a1.nmr_docto NotaFiscal,
   a1.dat_entrada DataEntrada,
   a1.val_calculado_bonificacao ValorNF,
   a1.cdg_cfop2 CFOP
   from bdodnfe a1, cadforn a2, cadfil a3
where a1.cdg_cfop2 = 1910 or a1.cdg_cfop2 = 2910
and a1.dat_entrada = today
    
asked by anonymous 27.10.2018 / 01:53

1 answer

0

There is a function in MySQL that picks up the current date, you can use it when you need to insert the current date into a record or compare with the current date. According to your description it seemed to be your need, in case your question is not improved by editing and giving more details.

select
   a1.cdg_filial Filial,
   a1.cdg_fornecedor Fornecedor,
   a2.dcr_fornecedor NomeFornecedor,
   a1.nmr_docto NotaFiscal,
   a1.dat_entrada DataEntrada,
   a1.val_calculado_bonificacao ValorNF,
   a1.cdg_cfop2 CFOP
   from bdodnfe a1, cadforn a2, cadfil a3
where a1.cdg_cfop2 = 1910 or a1.cdg_cfop2 = 2910
and a1.dat_entrada = CURDATE();
    
27.10.2018 / 02:41