|
||
|
|
#1 (permalink) |
|
Forum Newbie
Join Date: Nov 2006
Posts: 1
|
I am trying to get a report and I know how to do it but I dont like the way of doing it. I have two tables: Customers(id,name etc..), Transactions (transId,customerId,transTotal, transDate etc..) in mssql
what I need is transaction total per month for each customer. what I am trying to do is write a sql statement for each month and I have two parameters for sql select. startDate, endDate. It is easy to determine startDate (01/month/year), however i couldnt find an easy way of finding last day of the month. and I dont want to do it manually for each month. I need to loop it and there is also fucking february!! is there any other way of doing this? need a little help, thx ! Last edited by talikardi; 11-07-2006 at 03:10 PM. |
|
|
|
|
|
#2 (permalink) | |
|
Forum Expert
Join Date: Jul 2005
Location: Istanbul/Turkey
Age: 27
Posts: 425
|
if you are using Date object, you might get endDate by subtracting one day from next month.
however, what you are trying to achieve is too much simpler with something like this: Quote:
__________________
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|