I am using a time field in my where clause that is returning the proper results..except for April and May below is the query?
declare @sdate date
declare @edate date
set @sdate = dateadd(YY,-1,GETDATE())
set @edate = GETDATE()
select @sdate, @edate
select datepart(m,recorddate),SUM(qty_invoiced)
from inv_item
where item = 'f7000356'
and tax_date between @sdate and @edate
group by datepart(m,recorddate)
-------------------------------------------------------------------------------------
When i run the below the results are correct if i change the month to 05 again the results are correct?
select datepart(m,tax_date),SUM(qty_invoiced)
from inv_item
where item = 'f7000356'
and tax_date between '04/01/2012' and '04/30/2012'
group by datepart(m,tax_date)
Please help.