Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. SELECT
  2. sum(Property.user_assignable) AS total_NASF,
  3. sum(Property.user_gross) AS total_GSF,
  4. Region.description As Region,
  5. (CASE
  6. WHEN UDF.Custom005 = 'Educational'
  7. Then SUM(Property.user_assignable)
  8. End) As Educational_NASF,
  9. (CASE
  10. WHEN UDF.Custom005 = 'Educational'
  11. Then sum(Property.user_gross)
  12. End) As Educational_GSF,
  13. (CASE
  14. WHEN UDF.Custom005 = 'Residence Hall'
  15. Then sum(Property.user_assignable)
  16. End) As Residential_NASF,
  17. (CASE
  18. WHEN UDF.Custom005 = 'Residence Hall'
  19. Then sum(Property.user_gross)
  20. End) As Residential_GSF,
  21. (CASE
  22. WHEN UDF.Custom005 = 'Hospital'
  23. Then sum(Property.user_assignable)
  24. End) As Hospital_NASF,
  25. (CASE
  26. WHEN UDF.Custom005 = 'Hospital'
  27. Then sum(Property.user_gross)
  28. End) As Hospital_GSF
  29.  
  30. FROM
  31. ae_s_bld_c Property
  32. Inner JOIN dbo.ae_s_bld_c_udf UDF ON (Property.multitenant_id =
  33. UDF.multitenant_id)
  34. AND (Property.bldg = UDF.bldg)
  35. AND (Property.fac_id = UDF.fac_id)
  36. AND (Property.region_code = UDF.region_code)
  37. Inner Join ae_b_reg_e Region ON Property.multitenant_id =
  38. region.multitenant_id
  39. AND Property.region_code = Region.region_code
  40.  
  41. WHERE
  42. (Property.bldg_status = 'ACTIVE' OR
  43. Property.bldg_status = 'VACANT' OR
  44. Property.bldg_status = 'CONSTRUCTION') AND
  45. Property.owned_leased = 'Y' AND
  46. Property.prop_type = 'BUILDING' AND
  47. Property.bldg_class <> 'Parking Struct' AND
  48. Property.region_code LIKE '28%'
  49.  
  50. Group By
  51. Region.description,
  52. UDF.Custom005
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement