Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2001-06-24 : 12:34:53
|
| Mikhail Goncharov writes "I have two tables having one to one relationship andI need to update one of the tables with the summary (sum)of calculating values from the related table.Example: Table MemCharges (ChargeID(int), MemberID(int),ChDate (date), Amount (smallmoney), Status(tinyint))storing the charges for each member and datesand status for the charge (1-approved, 2- declined).Table MemPaid (MemberID, Tot_Paid(smallmoney))storing the results of membecharges for the reporting,total amount of the money paid by eachmember to date, approved only.I can update it now using the T-SQL cursor and then doing SUM for each row in memcharges table and then updating the MemPaid Table. Unfortunately it works pretty slow becauseI have approximately 3000 records in MemPaid table and 15000 in MemCharges Table.Is there anyway of doing it in one SQL statement ?" |
|
|
|
|
|