|
|
-
Paul Rizza Solved 1 Years ago through Puzzles
I had to resubmit this one because after I started to test with the test data I found a flaw. My original submission assumed that you could count on TotalQty staying in sync as the QTY changed with each transaction. The test data did not do this, but tth
|
-
Paul Rizza Commented 1 Years ago through Puzzles
I had to resubmit this one because after I started to test with the test data I found a flaw. My original submission assumed that you could count on TotalQty staying in sync as the QTY changed with each transaction. The test data did not do this, but tth
|
-
dishdy Commented 1 Years ago through Puzzles
wsantosf,
The call to RAND(1) at the beginning makes sure everyone generates the same data. Thus if you do not get the sum values I published then either my solution is wrong or your solution is wrong.
To solve this problem, the values of Qty are un
|
-
Paul Rizza Commented 1 Years ago through Puzzles
His "rand" has a static seed value. The seed value sets the starting point for the random numbers generated.
For example:
Rand(1)
Rand(1)
Rand(1)
Will Return the exact same number 3 times because I seed it each time. If you truely want to make su
|
-
dishdy Commented 1 Years ago through Puzzles
McAuely, do you have a cpu count? My stats are very bad so I'm completely changing my approach - and thinking hard about Peso's one pass solution.
(10000 row(s) affected)
Table 'Worktable'. Scan count 2683, logical reads 2395150, physical reads
|
-
wsantosf Commented 1 Years ago through Puzzles
Dishdy: since you use rand(), won't your test data be different for each person who runs it? That way it will be hard to compare solutions anyway.
Even though, it helped me find a bug the original short test data didn't show.
I also believe the totalqty
|
-
wsantosf Solved 1 Years ago through Puzzles
First 'solution' was wrong (test data wouldn't show it though, it fails if more than 3 blocks exist for a single accountno, instrumentid.
Fist query (cte) gets blockno, select then uses row_number to sequence within the block.
|
-
McAuley Commented 1 Years ago through Puzzles
I have no idea. I just started doing these things and I'm in this to learn better ways.
|
-
Peso Commented 1 Years ago through Puzzles
No. The idea is to encourage people to find better/different solutions.
By showing the reads, we display that there are other solutions.
|
-
Paul Rizza Commented 1 Years ago through Puzzles
Hi guys,
I think I am missing something here, is the goal of the challenge to find a single winner with the best logic read and scan count numbers?
Thanks,
Paul
|