2
This happens because field datavenda
table vendas
is the type timestamp
, your query is being interpreted as follows:
SELECT * FROM venda ve WHERE ve.datavenda <= '28/08/2016 00:00:00.000000';
What does not include the records 28/08/2016 02:33:36.372
and 28/08/2016 02:55:46.873
, and explains the behaviour described.
There are two possible solutions to your problem:
SELECT * FROM venda ve WHERE ve.datavenda <= '28/08/2016 23:59:59.999999';
or
SELECT * FROM venda ve WHERE ve.datavenda::date <= '28/08/2016';
I hope I’ve helped!
neither need use date the field is already in time Stamp
SELECT * FROM venda WHERE datavenda <= '2016-08-28'
– Jasar Orion
No, I don’t see any mistake! This is correct @stderr
– Nayron Morais
What is the expected return?
– gmsantos
Can I ask you a question of personal curiosity? Why do people write "Postgree"? I understand some confusion with the name, but I never understood this one. That’s not the product name, nickname, abbreviation, nothing. What does it mean?
– Maniero
@bigown I know there is something close to what he commented, but at the time of pronunciation in English, which if written in Portuguese would be close to "postgree".
– Nayron Morais