rajvja
asked on
Complex sql query
Hi Experts,
I am struggling to generate the resultset.
I have a table which hold StorePointsByCustomer
Please see the attached spreadsheet what I need to generate.
I need to get the points spent split by earnings.
PointsQuery.xlsx
I am struggling to generate the resultset.
I have a table which hold StorePointsByCustomer
Please see the attached spreadsheet what I need to generate.
I need to get the points spent split by earnings.
PointsQuery.xlsx
ASKER
Hi santhimurthyd,
Thanks for the reply.
I need to generate the result for SpentPoints. As I said, the points might have earned on different transactions. So, I want all the earn dates corresponding toeach spent transaction.
Hope you understand.
Thanks for the reply.
I need to generate the result for SpentPoints. As I said, the points might have earned on different transactions. So, I want all the earn dates corresponding toeach spent transaction.
Hope you understand.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
PS: I realise that you will have to port it to SQL Server, but once I got started thinking about a possible algorithm, I had to go through with it. In the end, it's quite similar to what michalsmiechowski just suggested.
(°v°)
(°v°)
If you can explain in words what you want will help. From that file I cannot understand what exactly it is that you want to achieve.
Comment removed. Posted in the wrong question.
ASKER
Hi all,
My requirement is to get spent points based on the earned date.
My requirement is to get spent points based on the earned date.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks guys but sorry that the solutions not solved my problem
Sorry I couldn't help more. Success with your project! — (°v°)
Could you share more about your requiremnt
In the Result table you have all teh TransactionId's as 4, whre in the source table it's 1,2,..6.
Is it's the requirment and also on which condition the Earnign Points are getting splitted into the record which si not having and aslo teh no of records in Source is 6, where as in the result it's 5.