SHARE
TWEET

LastSucKatka

PRP_UA Feb 25th, 2020 248 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. WITH LastSucKatka
  2. AS (
  3.     SELECT DISTINCT fr.UserId AS U_ID
  4.     ,MAX([Timestamp]) AS LastSucKatka
  5.     FROM FinishRun as fr join users on users.userid=fr.userid
  6.     WHERE RoomName != '-2'
  7.     AND registrationclientversion='0.0.124'
  8.     GROUP BY fr.UserId
  9. )
  10.  
  11.  
  12. SELECT TOP (1)
  13.     count(distinct e.userid) users,
  14.     count(*) spins,
  15.     sum(productamount) as TotalGold
  16.     ,avg(productamount) as AvgGold
  17.   FROM [dbo].[EventsProductMovement] as e INNER JOIN LastSucKatka on UserId = U_ID
  18.   where
  19.    action='temp_received'
  20.     and triggersourceid='ads_wheel'
  21.     and triggerid like '4%'
  22.     and Timestamp <= LastSucKatka
  23.     and producttype='gold'
  24.     and productamount<9999
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top