What am I doing wrong? I have an query to get data between two dates, but it does not get the last date.
I tried
select *
from data
where dates between '2016-01-01' and '2016-01-02'
and
select *
from data
where dates >= '2016-01-01' and dates <= '2016-01-02'
I need SQL Server to return data between 2016-01-01 and 2016-01-02
Output should be
pid name date
-------------------------------
1 test2 2016-01-02
2 test2 2016-01-01
3 test3 2016-01-02
This works
select *
from data
where dates >= '2016-01-01' and dates <= '2016-01-03'
but why do I need to add an extra day?