Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi everybody.
I cant ponder how to do that. We have clients who use our transportation service. I constructed sql server table with name Debt its relationed with transportation ID and client ID. Clients always pay money at end of month. How can i do with c# or sql server that count all entries from month begining to end of month ?
Sorry for my bad English.
I hope that my question is understandable.
Please Advice me something...
Posted

As i understand ur question,
Select count(*) from tablename where paidDate >= '01/11/2010' and paidDate <= '30/11/2010'
 
Share this answer
 
Well, first of all design the datavase tables such that you can capture all data.

For now, assuming once a transporationID is related to a ClientID, whole month is used. It would give something like, transportation cost of that transportationID * 30 days!

Thus, to be generic, you need to capture all the used days with cost and then at the end write a query for that client and get all data.
 
Share this answer
 
First u get the last month amount and keep it in one variable,
Select Sum(amount) from tablename where paidDate >= '01/11/2010' and paidDate <= '30/11/2010'

then,
insert into tablename(remain_amount) values(last_amount - 1000) 

1000 is the currenty entered amount.
 
Share this answer
 
v2
Thanks guys
but I forgot to say that operator who use this application at the end of month will input integers which must Subtraction that value which is from month to month
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900