SELECT curr_state_name AS curr_name, curr_state_id, IF(next_state_name = '', 'END', next_state_name) as next_name, next_state_id, capturedigit_digit, forwarded_to, SUM(numCalls) as call_flow FROM LeadTreeCalls_ivr_data_summary
WHERE dnis = 8452888678 AND curr_state_name is not null AND curr_state_id != next_state_id GROUP BY curr_state_id, next_state_id, forwarded_to
forked from anonymous's block: Sankey diagram using a csv file with v4
https://d3js.org/d3.v4.min.js