SELECT TOP 100000 t0._id,t0.TranDate,t0.Category,t0.TranAmount,
t0.TranBaseType,t0.Time_Of_Day, sum(t1.TranAmount) AS trans_total,
count(*) AS trans_count
FROM [CreditSense].[dbo].[Transaction] AS t0
INNER JOIN [CreditSense].[dbo].[Transaction] AS t1
ON t0._id=t1._id
WHERE t0.TranDate IS NOT NULL AND t1.TranDate IS NOT NULL AND
t1.TranDate >= t0.TranDate AND t1.TranDate < (t0.TranDate) + 30
GROUP BY t0._id
ORDER BY t0.TranDate, t0._id;
I'm trying to get this to work for my data-set, but I'm getting this following error "Msg 206, Level 16, State 2, Line 1 Operand type clash: date is incompatible with int"
Is it because of adding 30? if so please recommend an alternative method please!!
date
+integer
like demonstrated there. But that does not work the same way in SQL Server.