79246495

Date: 2024-12-03 06:39:39
Score: 1
Natty:
Report link

Shouldn't this work?

SELECT 
  CASE month
    WHEN jan THEN  1
    WHEN feb THEN  2
    WHEN mar THEN  3
    WHEN apr THEN  4
    ELSE 'other'
  END AS monthno
, *
FROM monthly_sales
UNPIVOT (sales FOR month IN (jan as 1, feb as 2, mar as 3, apr as 4))
ORDER BY empid, 1;                                                         
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • High reputation (-1):
Posted by: marcothesane