daily pastebin goal
61%
SHARE
TWEET

Untitled

a guest Sep 20th, 2018 65 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. SELECT
  2.  
  3. CAST(CASE
  4. WHEN a = b
  5. THEN i
  6. ELSE i+1
  7. END AS bit) as id
  8.  
  9. FROM mytable
  10.    
  11. SELECT a, b, sum(i) over(order by x) as id
  12.   FROM (
  13.     SELECT a, b, CASE WHEN a = b THEN 1 ELSE 0 END as i
  14.       FROM mytable
  15.   ) x
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