SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 95 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2. --   users.id, SUM(orders.advertiser_expected_payout - orders.affiliate_payout -  affiliate_ref_payout)
  3.       SUM(orders.advertiser_expected_payout - orders.affiliate_payout -  affiliate_ref_payout)
  4. FROM
  5.   orders
  6. LEFT JOIN
  7.   offers_advertiser_offers
  8. ON
  9.   (orders.advertiser_offer_id = offers_advertiser_offers.id)
  10. LEFT JOIN
  11.   users
  12. ON
  13.   (orders.user_id = users.id)
  14. LEFT JOIN
  15.   users_reg_data
  16. ON
  17.   users.reg_data_id = users_reg_data.id
  18. WHERE
  19.   DATE_ADD(users.registered_at, INTERVAL 3 HOUR) >= "2019-03-01 00:00:00"
  20. AND  
  21.   DATE_ADD(users.registered_at, INTERVAL 3 HOUR)  < "2019-04-01 00:00:00"
  22. AND
  23.   DATE_ADD(orders.created_at, INTERVAL 3 HOUR) >= "2019-03-01 00:00:00"
  24.  AND  
  25.    DATE_ADD(orders.created_at, INTERVAL 3 HOUR)  < "2019-04-01 00:00:00"
  26.  AND
  27.   orders.advertiser_payout_currency = "RUB"
  28. AND
  29.   orders.affiliate_payout_currency = "RUB"
  30. AND
  31.   orders.real_status = 10
  32. AND
  33.   post_id is Null
  34. AND
  35.   offers_advertiser_offers.advertiser_id <> 12641
  36. -- orders.advertiser_expected_payout - orders.affiliate_payout -  affiliate_ref_payout >= 0
  37. AND
  38.   users.is_cpa_network = 0
  39.  AND
  40.   users_reg_data.utm_source is not Null
  41.  AND
  42.   users_reg_data.utm_source <> 'landings'
  43.  AND
  44.   users_reg_data.utm_source <> ''
  45. -- GROUP BY
  46. --   user_id
  47. -- INTO OUTFILE '/tmp/data1.txt'
  48. -- FIELDS TERMINATED BY ','
  49. -- LINES TERMINATED BY '\n'
  50. ;
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