-
count in same month
hi...
i have a question to ask here.
how i want to count total of money in same month?
let say....in 10/9/2004 i have 200, then 11/9/2004 = 500, 12/9/2004=300.
how i want coding to count total money in mont sept is 1000 (200+500+300)?
i use sql server 7.0 as my database and visual basic 6.
hope all of u can help me...
thanks...
-
Re: count in same month
u use it in SQL statement
"SELECT SUM(money) FROM ur_tablename GROUP BY ur_month"
hope this can help
-
Re: count in same month
If your dates are stored in 1 field (which I presume will be the case), you can use the DATEPART function.
Code:
SELECT Sum(Amount)
FROM TableName
WHERE DATEPART(Year, DateField) = 2004
AND DATEPART(Month, DateField) = 9
where Amount is the field that holds the amount of money, and DateField the field that holds the date.
-
Re: count in same month
thaks q....
i will try it.