Reputation: 11
I have two dates ex:('Jan 1 2016' and 'Jan 10 2016')
how can I select number of rows between these dates
like: dates
jan 1
jan 2
jan 2
...
jan 10
thanks..
Upvotes: 0
Views: 53
Reputation: 1026
Use this query
select * from tableName where columnname>='2016-01-01' and columnname<='2016-01-10'
Upvotes: 0
Reputation: 24792
use a tally / number table
select date = dateadd(day, n, '20160101')
from number n -- <= tally / number table
where n.n >= 0
and n.n < datediff(day, '20160101', '20160110')
Upvotes: 1