query updated to genereate csvs for approval flows, csvs also updated