Advertisement
Guest User

Untitled

a guest
Jan 29th, 2017
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
T-SQL 0.57 KB | None | 0 0
  1. SELECT [Name] AS [Game]
  2.      , CASE
  3.             WHEN DATEPART(hour,[Start]) >= 0 AND DATEPART(hour,[Start]) < 12 THEN 'Morning'
  4.             WHEN DATEPART(hour, [Start]) >= 12 AND DATEPART(hour,[Start]) < 18 THEN 'Afternoon'
  5.             WHEN DATEPART(hour, [Start]) >= 18 AND DATEPART(hour,[Start]) < 24 THEN 'Evening'
  6.        END AS 'Part of the Day'
  7.      , Case
  8.             WHEN [Duration] <= 3 THEN 'Extra Short'
  9.             WHEN [Duration] >= 4 AND [Duration] <= 6 THEN 'Short'
  10.             WHEN [Duration] > 6 THEN 'Long'
  11.             ELSE 'Extra Long'        
  12.        END AS 'Duration'
  13.      
  14.   FROM Games
  15. ORDER BY [Name],
  16.          [Duration],
  17.          [Start]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement