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 |
a2zwd
Starting Member
1 Post |
Posted - 2012-09-06 : 12:36:28
|
Hi experts,I have customer reward points data. I have 2 tables.1. CumulativeCredit -> Customer credited points and cumulative total2. CumulativeDebit -> Customer debited points and cumulative totalFrom these 2 tables, I need to generate resultset to show how the customer points are debited. I mean the points debited are to be distributed as per they earned.See attached spreadsheet for sample data and expected resultset.I am totally mad to solve this.Could someone have an eye on this and suggest how to achieve the result?CumulativeCreditCustomerId Transid CreditPoints TransDate CumulativeCredit ----------------------------------------------------101 111 100 01/01/2012 100 101 112 500 05/01/2012 600 101 114 200 20/01/2012 800 CumulativeDebit CustomerId Transid DebitPoints TransDate CumulativeDebit ---------------------------------------------------101 113 250 10/01/2012 250 CustomerDebit as per credit date CustomerId DebitPoints NetDebitPoints CreditTransId DebitDate CreditTransDate---------------------------------------------------------------101 250 100 111 40918 40909101 250 150 112 40918 40913thanks |
|
|
|
|