4
I have an SQL query that should bring me only records whose date is longer than the date of the day, but records with the current date are coming. Thanks!
--não deveria mostrar a data de hoje
select a.datavencimento from TB_RECEBIMENTO a
left outer join tb_plano_contas b on a.controleplano = b.controleplano
left outer join tb_cliente_fornecedor d on a.controlecliente = d.controlecliente
where getdate() > a.datavencimento
and a.statusregistro = 'A'
and b.tipododocumento = 'C'
and a.controleempresa = '1'
order by a.datavencimento asc
Upshot:
2015-04-27 00:00:00.000
2015-04-27 00:00:00.000
2015-04-27 00:00:00.000
2015-04-28 00:00:00.000
2015-04-28 00:00:00.000
2015-04-28 00:00:00.000
2015-04-28 00:00:00.000
2015-04-28 00:00:00.000
This solution applies to any SQL Server edition. If you are using SQL Server 2008 or higher, the bfavaretto solution is also valid.
– Marcus Vinicius