SHARE
TWEET

Untitled

a guest Jul 23rd, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 1-4 years = T1
  2.     5-9 years = T2
  3.     10-15 years = T3
  4.     15+ years = T4
  5.      
  6. 10/03/2016 = T1
  7.      01/18/2010 = T2
  8.      01/14/2006 = T3
  9.      12/07/2002 = T4
  10.      
  11. SELECT
  12. CASE
  13.     WHEN hire_date < DATEADD(YY,-15,GETDATE()) THEN 'T4'
  14.     WHEN hire_date < DATEADD(YY,-10,GETDATE()) THEN 'T3'
  15.     WHEN hire_date < DATEADD(YY,-5,GETDATE()) THEN 'T2'
  16.     ELSE 'T1'
  17. END
  18. FROM your_table
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