daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Feb 25th, 2018 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. SELECT
  2.   customer_id
  3.   , launch_at
  4.   , count(is_first_occurence) over (ORDER BY launch_at) preceeding_customer_count
  5. FROM
  6.   (
  7.     SELECT
  8.       customer_id
  9.       , launch_at
  10.       , (CASE WHEN row_number() over ( PARTITION BY customer_id ORDER BY launch_at) = 1 THEN 1 ELSE NULL END) AS is_first_occurence
  11.     FROM
  12.     [table_with_launches]
  13.   )
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