Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*View the number of service requests of each complaint_type in each category*/
- SELECT category, compaint_type, count(*) FROM `nodal-component-204421.311_complaints.complaints`
- GROUP BY 1, 2
- ORDER BY 1, 3 DESC
- /*Update Example - Single change*/
- UPDATE `nodal-component-204421.311_complaints.complaints`
- SET category = 'Advocate'
- WHERE LOWER(complaint_type) LIKE '%advocate%'
- /*Update Example - Multiple changes*/
- UPDATE `nodal-component-204421.311_complaints.complaints`
- SET category = CASE
- WHEN LOWER(complaint_type) LIKE '%advocate%' THEN 'Advocate'
- WHEN LOWER(complaint_type) LIKE '%vending%' THEN 'Vending'
- ELSE category
- END
- WHERE category = 'Other'
Add Comment
Please, Sign In to add comment