SELECT city ,SUM(count_num) ,SUM(isreach_num)
FROM dw_device_optless_week w
WHERE city in ('${city}')
and w.detail_date>=to_date(trunc(to_date('$start_time','yyyy/mm/dd') -to_number(to_char(to_date('$start_time','yyyy/mm/dd') - 1, 'd'))+1, 'dd'),'yyyy/mm/dd')
and w.detail_date<=trunc(to_date('$start_time','yyyy/mm/dd') -to_number(to_char(to_date('$start_time','yyyy/mm/dd') - 1, 'd'))+7, 'dd')
GROUP BY w.city,w.city_code
ORDER BY w.city_code