Hello.
I'm not well aware use of DENSE_RANK, but I discover it could be very usefull to avoid long PHP code...
I would like to Take all my Cards from Discard and send them randomly to the Draw Stack.
sublocation will then be 1 to N, where N is the number of cards found as DISCARD in location.
I would like to set this sublocation randomly... this is why i use NEWID() ....
But something is WRONG in my use of DENSE_RANK...
I've added 'PARTITION BY id' to have an unique field, but I'm not sure it's the good way, And I don't know why adding something there... because DENSE_RANK and NEWID seems to be enough for my needs...
Anyone is able to explain what's wrong?
thanks.
I'm not well aware use of DENSE_RANK, but I discover it could be very usefull to avoid long PHP code...
I would like to Take all my Cards from Discard and send them randomly to the Draw Stack.
sublocation will then be 1 to N, where N is the number of cards found as DISCARD in location.
I would like to set this sublocation randomly... this is why i use NEWID() ....
But something is WRONG in my use of DENSE_RANK...
Code: Select all
UPDATE card SET card_location='DRAW',card_sublocation=DENSE_RANK() OVER (PARTITION BY id Order By NEWID()) WHERE card_location='DISCARD' and card_type='EQP'Anyone is able to explain what's wrong?
thanks.