Advertisement
Guest User

Untitled

a guest
Jul 11th, 2017
451
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.24 KB | None | 0 0
  1. Prod Date Time Cust Lname Fname Street 1 S2 City Zip Email CSI Action Dog Prog TourHeadsets
  2. Tosca 08-Apr-17 2:30 PM 122253 Smith Michael 33 Rodeo Drive NULL Beverley Hills 90210 msmith@email.com NULL NULL 0 None 0 1
  3. Tosca 08-Apr-17 2:30 PM 122253 Smith Michael 33 Rodeo Drive NULL Beverley Hills 90210 msmith@email.com NULL NULL 0 Large 0 0
  4. Tosca 08-Apr-17 2:30 PM 122253 Smith Michael 33 Rodeo Drive NULL Beverley Hills 90210 msmith@email.com NULL NULL 0 None 2 0
  5. Tosca 08-Apr-17 2:30 PM 125634 Brown Sarah 22 Victory Drive NULL Beverley Hills 90210 sbrown@email.com NULL NULL 0 Large 0 0
  6. Tosca 08-Apr-17 2:30 PM 125634 Brown Sarah 22 Victory Drive NULL Beverley Hills 90210 sbrown@email.com NULL NULL 0 None 2 0
  7. Tosca 08-Apr-17 2:30 PM 125634 Brown Sarah 22 Victory Drive NULL Beverley Hills 90210 sbrown@email.com NULL NULL 0 None 0 2
  8.  
  9. Prod Date Time Cust Lname Fname Street 1 S2 City Zip Email CSI Action Dog Prog Tour Headsets
  10. Tosca 08-Apr-17 2:30 PM 122253 Smith Michael 33 Rodeo Drive NULL Beverley Hills 90210 msmith@email.com NULL NULL 0 Large print 2 1
  11. Tosca 08-Apr-17 2:30 PM 125634 Brown Sarah 22 Victory Drive NULL Beverley Hills 90210 sbrown@email.com NULL NULL 0 Large print 2 2
  12.  
  13. USE impresario
  14. SELECT
  15. g.description AS 'Production'
  16. ,CONVERT(varchar,f.perf_dt,106) AS 'Date'
  17. ,FORMAT(CAST(f.perf_dt AS DATETIME),'h:mm tt') AS 'Time'
  18. ,a.customer_no AS 'Customer'
  19. ,b.lname AS 'Last name'
  20. ,b.fname AS 'First name'
  21. ,c.street1 AS 'Street 1'
  22. ,c.street2 AS 'Street 2'
  23. ,c.city AS 'City'
  24. ,c.postal_code AS 'Postal code'
  25. ,d.address
  26. ,a.notes AS 'CSI notes'
  27. ,e.notes AS 'Action notes'
  28. ,CASE h.id
  29. WHEN 14 THEN '1'
  30. WHEN 15 THEN '2'
  31. ELSE '0'
  32. END
  33. AS 'Dogs'
  34. ,CASE h.id
  35. WHEN 16 THEN 'Large print'
  36. WHEN 17 THEN 'Braille'
  37. ELSE 'None'
  38. END
  39. AS 'Programmes'
  40. ,CASE h.id
  41. WHEN 18 THEN '1'
  42. WHEN 19 THEN '2'
  43. ELSE '0'
  44. END
  45. AS 'Touch tour'
  46. ,CASE h.id
  47. WHEN 20 THEN '1'
  48. WHEN 21 THEN '2'
  49. ELSE '0'
  50. END
  51. AS 'Headsets'
  52. FROM T_CUST_ACTIVITY a
  53. JOIN T_CUSTOMER b ON b.customer_no=a.customer_no
  54. JOIN T_ADDRESS c ON c.customer_no=a.customer_no
  55. JOIN T_EADDRESS d ON d.customer_no=a.customer_no
  56. JOIN T_ISSUE_ACTION e ON e.activity_no=a.activity_no
  57. JOIN T_PERF f ON f.perf_no=a.perf_no
  58. JOIN T_INVENTORY g ON g.inv_no=f.prod_season_no
  59. JOIN TR_ACTION h ON h.id=e.action
  60. WHERE a.activity_type=21 --'Access requirements' from TR_CUST_ACTIVITY_TYPE
  61. AND c.primary_ind='Y' --Primary addresses only
  62. AND d.primary_ind='Y' --Primary emails only
  63. AND e.action IN
  64. (
  65. 14 --Dog x1
  66. ,15 --Dog x2
  67. ,16 --Programme (large print)
  68. ,17 --Programme (braille)
  69. ,18 --Touch tour x1
  70. ,19 --Touch tour x2
  71. ,20 --Headset x1
  72. ,21 --Headset x2
  73. )
  74. ORDER BY f.perf_dt, a.customer_no ASC
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement