Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.02 KB | None | 0 0
  1. SELECT DISTINCT
  2. count(ost_ticket.ticket_id) as cuenta,ost_help_topic.topic_id ,
  3. CASE
  4. WHEN ost_help_topic.topic_id = 24 || ost_help_topic.topic_id = 25 THEN "Agenda Médica(Caso - V.2)"
  5. WHEN ost_help_topic.topic_id = 35 || ost_help_topic.topic_id = 29 THEN "Stock y Recetas"
  6. WHEN ost_help_topic.topic_id = 20 || ost_help_topic.topic_id = 85 || ost_help_topic.topic_id = 83 THEN "Administrativos"
  7. WHEN ost_help_topic.topic_id = 71 || ost_help_topic.topic_id = 79 THEN "RCE - RCO"
  8. WHEN ost_help_topic.topic_id = 63 || ost_help_topic.topic_id = 33 THEN "Tele"
  9. WHEN ost_help_topic.topic_id = 30 THEN "Urgencia"
  10. WHEN ost_help_topic.topic_id = 72 || ost_help_topic.topic_id = 28 THEN "Reportería y DataWH"
  11. WHEN ost_help_topic.topic_id = 21 || ost_help_topic.topic_id = 75 THEN "Manager"
  12. WHEN ost_help_topic.topic_id = 27 THEN "Interconsulta"
  13. WHEN ost_help_topic.topic_id = 34 || ost_help_topic.topic_id = 46 THEN "Archivos (Fichas)"
  14. END
  15. AS topic,
  16. CASE
  17. WHEN ost_help_topic.topic_id = 24 || ost_help_topic.topic_id = 25 THEN 1
  18. WHEN ost_help_topic.topic_id = 35 || ost_help_topic.topic_id = 29 THEN 2
  19. WHEN ost_help_topic.topic_id = 20 || ost_help_topic.topic_id = 85 || ost_help_topic.topic_id = 83 THEN 3
  20. WHEN ost_help_topic.topic_id = 71 || ost_help_topic.topic_id = 79 THEN 4
  21. WHEN ost_help_topic.topic_id = 63 || ost_help_topic.topic_id = 33 THEN 5
  22. WHEN ost_help_topic.topic_id = 30 THEN 6
  23. WHEN ost_help_topic.topic_id = 72 || ost_help_topic.topic_id = 28 THEN 7
  24. WHEN ost_help_topic.topic_id = 21 || ost_help_topic.topic_id = 75 THEN 8
  25. WHEN ost_help_topic.topic_id = 27 THEN 9
  26. WHEN ost_help_topic.topic_id = 34 || ost_help_topic.topic_id = 46 THEN 10
  27. END as topic_id_alias
  28.  
  29. FROM
  30. ost_ticket
  31. right OUTER JOIN ost_help_topic ON ost_ticket.topic_id = ost_help_topic.topic_id
  32. AND ost_help_topic.dept_id = 10 AND ost_ticket.status_id = 1
  33. GROUP BY
  34. topic
  35. ORDER BY
  36. topic asc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement