-
September 14th, 2004, 09:44 PM
#1
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...
-
September 14th, 2004, 10:10 PM
#2
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
-
September 15th, 2004, 02:51 AM
#3
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.
-
September 15th, 2004, 09:04 PM
#4
Re: count in same month
thaks q....
i will try it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|