|
|
-
OldStd Solved 6 Months ago through Puzzles
I couldn't understand the statement of the puzzle until I took a peek at the solution (v5) given by Leszek Gniadkowski.
My solution is re-written to show my understanding of the puzzle since, thanks to Leszek Gniadkowski.
|
-
OldStd Commented 7 Months ago through Puzzles
This is my third attempt to solve the puzzle. This solution is slightly simpler than the previous two.
|
-
OldStd Solved 7 Months ago through Puzzles
This is my third attempt to solve the puzzle. This solution is slightly simpler than the previous two.
|
-
OldStd Solved 7 Months ago through Puzzles
This is a second attempt to the solution that is slightly simpler than the previous one but with no change in the main logic.
|
-
OldStd Commented 7 Months ago through Puzzles
My solution displayed:
ProductID Start_Date End_Date TotalLines LinesOutOfService TotalCustomerCalls
522 2010/04/05 2010/04/06 345 5 180
522 2010/04/07 2010/04/07 120 4 50
522 2010/04/08 2010/04/10 345 5 170
5
|
-
OldStd Solved 7 Months ago through Puzzles
Copy the given sample data into a cte.
Process the start date and end date as directed in the puzzle.
Sum up the CustomerCalls for each group.
|
-
OldStd Commented 8 Months ago through Puzzles
The results:
Date CustomerID Type Amount Balance
2011-01-01 CUST1001 INV 12000.00 12000.00
2011-01-02 CUST1001 PAY 3000.00 9000.00
2011-01-03 CUST1001 INV 8000.00 17000.00
2011-01-04 CUST1001 PAY 9000.00 8000.00
2011-01-04 C
|
-
OldStd Commented 8 Months ago through Puzzles
This solution is contructed in sql 2012 evaluation edition making use of the OVER clause of the SUM function and also the CAST function for datetime to date format.
|
-
OldStd Solved 8 Months ago through Puzzles
This solution is contructed in sql 2012 evaluation edition making use of the OVER clause of the SUM function and also the CAST function for datetime to date format.
|
-
OldStd Commented 8 Months ago through Puzzles
Re-submitted without html tags/scripts
The running total is obtained by using a simple recursive CTE
|