Consult a field with datetime year to Second format, asking to bring only today’s records?

Asked

Viewed 19 times

0

I would like to know how to fetch a date record, but bring this dat_entrada only with the current date? Follow 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

1 answer

0

There is a function in Mysql that takes the current date, you can use it when you need to insert the current date into a record or compare it to the current date. According to your description seemed to be your need, if not improve your question 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();

Browser other questions tagged

You are not signed in. Login or sign up in order to post.