We have this table, where players' actions are being recorded. I want to know where people buy their equipment ( item bo or sword) can be purchased at the shop or auction (in the action column) ) Therefore, when the player purchases an item, we will have to search for the verb {/ code> shop or auction (depending on what the item was bought before one of them was purchased) < / P> ** User Time Action Item ** 1 12:00 Auction 2 12:01 Shop 3 12:04 Shop 4 12:09 Shop 4 12:15 Bow 2 Buy Auction 2 12:19 Auction 1 12:25 Chat 4 12:33 33 Auction 3 12:47 Chat 1 12:47 Buy Swords 2 12:47 Bow 3 Buy 12:50 Sword 4 Buy 12:52 Bow 3 Buy 12:56 Bow Bought Result
Time Item Location ** 12:15 Bow Shop 12:47 Sword Auction 12:47 Bow Auction 12:50 Swords Shop 12:52 Bow Auction 12:56 Bow Shop I think I have found a clue that it can Scope applies Msssiel with the solution is, but is it possible to do without solving it? I may have to use the hyphen in the question too, I would be grateful for any answer. Thanks!
You want something like this (and I think you can also like the user there, Eh?) Renewed Answer Thanks for the tip of Tim
as P - Purchased Purchase (Selection [User], [Time] Bought, [Item] ] Where actions [actions] = 'buy'), in the form of e - where something can be bought (select [user], [time] entered, actions from [action] place where [Action] 'Auction', 'Shops')), as G - All pre-entrance (selection p. [User], p [purchased], p [item], e. [Insert], e [place ] From P user to P [user] = E. [user] and p. [Purchased]> gt; = e. [Entered]), - Rank penetration door proximity (select *, row_number ( ) ([User] by [user], [purchased], [item] order [entered] by order) as rnk - only select where the trend She is the closest [user], [purchased], [item], [place] from [user] by [user], [bought], [item] Warning: TSQL is not my original bid; -)
No comments:
Post a Comment