Advertisement
Guest User

Untitled

a guest
May 2nd, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.38 KB | None | 0 0
  1. select school_nam, schoolid, cps_safe_passage_routes.the_geom, date_part('hour', crimes_2001_to_present.date::date)
  2. sum( CASE 1 WHEN primary_description='PROSTITUTION' ELSE 0) as prostitution_count,
  3. sum( CASE 1 WHEN primary_description='OTHER OFFENSE' ELSE 0) as other_count,
  4. sum( CASE 1 WHEN primary_description='THEFT' ELSE 0) as theft_count,
  5. sum( CASE 1 WHEN primary_description='LIQUOR LAW VIOLATION' ELSE 0) as liquor_law_violation_count,
  6. sum( CASE 1 WHEN primary_description='NON-CRIMINAL' ELSE 0) as non_criminal_count,
  7. sum( CASE 1 WHEN primary_description='BURGLARY' ELSE 0) as burglary_count,
  8. sum( CASE 1 WHEN primary_description='PUBLIC PEACE VIOLATION' ELSE 0) as public_peace_violation_count,
  9. sum( CASE 1 WHEN primary_description='RITUALISM' ELSE 0) as ritualism_count,
  10. sum( CASE 1 WHEN primary_description='HOMICIDE' ELSE 0) as homicide_count,
  11. sum( CASE 1 WHEN primary_description='BATTERY' ELSE 0) as battery_count,
  12. sum( CASE 1 WHEN primary_description='ARSON' ELSE 0) as arson_count,
  13. sum( CASE 1 WHEN primary_description='NARCOTICS' ELSE 0) as narcotics_count,
  14. sum( CASE 1 WHEN primary_description='OFFENSE INVOLVING CHILDREN' ELSE 0) as offense_involving_children_count,
  15. sum( CASE 1 WHEN primary_description='GAMBLING' ELSE 0) as gambling_count,
  16. sum( CASE 1 WHEN primary_description='HUMAN TRAFFICKING' ELSE 0) as human_trafficking_count,
  17. sum( CASE 1 WHEN primary_description='ASSAULT' ELSE 0) as assult_count,
  18. sum( CASE 1 WHEN primary_description='MOTOR VEHICLE THEFT' ELSE 0) as motor_vehicle_theft_count,
  19. sum( CASE 1 WHEN primary_description='INTIMIDATION' ELSE 0) as intinidation_count,
  20. sum( CASE 1 WHEN primary_description='CONCEALED CARRY LICENSE VIOLATION' ELSE 0) as concealed_carry_license_violation_count,
  21. sum( CASE 1 WHEN primary_description='PUBLIC INDECENCY' ELSE 0) as public_indecency_count,
  22. sum( CASE 1 WHEN primary_description='ROBBERY' ELSE 0) as robbery_count,
  23. sum( CASE 1 WHEN primary_description='WEAPONS VIOLATION' ELSE 0) as weapons_violation_count,
  24. sum( CASE 1 WHEN primary_description='KIDNAPPING' ELSE 0) as kidnapping_count,
  25. sum( CASE 1 WHEN primary_description='INTERFERENCE WITH PUBLIC OFFICER' ELSE 0) as interference_with_public_officer_count,
  26. sum( CASE 1 WHEN primary_description='NON-CRIMINAL (SUBJECT SPECIFIED)' ELSE 0) as non_criminal_subject_specified_count,
  27. sum( CASE 1 WHEN primary_description='CRIM SEXUAL ASSAULT' ELSE 0) as crim_sexual_assult_count,
  28. sum( CASE 1 WHEN primary_description='CRIMINAL TRESPASS' ELSE 0) as criminal_trespass_count,
  29. sum( CASE 1 WHEN primary_description='NON - CRIMINAL' ELSE 0) as non_criminal_count,
  30. sum( CASE 1 WHEN primary_description='DOMESTIC VIOLENCE' ELSE 0) as domestic_violence_count,
  31. sum( CASE 1 WHEN primary_description='CRIMINAL DAMAGE' ELSE 0) as criminal_damage_count,
  32. sum( CASE 1 WHEN primary_description='SEX OFFENSE' ELSE 0) as sex_offence_count,
  33. sum( CASE 1 WHEN primary_description='STALKING' ELSE 0) as salking_count,
  34. sum( CASE 1 WHEN primary_description='OTHER NARCOTIC VIOLATION' ELSE 0) as other_narcotic_violation_count,
  35. sum( CASE 1 WHEN primary_description='DECEPTIVE PRACTICE' ELSE 0) as deceptive_practice_count,
  36. sum( CASE 1 WHEN primary_description='OBSCENITY' ELSE 0) as obscennity_count
  37. FROM stuartlynn.cps_safe_passage_routes, stuartlynn.crimes_2001_to_present
  38. where ST_WITHIN( crimes_2001_to_present.the_geom , ST_BUFFER(cps_safe_passage_routes.the_geom::geography, 30)::geometry)
  39. group by schoolid, school_nam, cps_safe_passage_routes.the_geom
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement