SELECT ID,
sum(date_n between DATE_SUB( NOW(), INTERVAL 1 YEAR) and NOW() ) as sum_YEAR
sum(date_n between DATE_SUB( NOW(), INTERVAL 1 MONTH) and NOW() ) as sum_MONTH
sum(date_n between DATE_SUB( NOW(), INTERVAL 7 DAY) and NOW() ) as sum_WEEK
FROM `DETAIL`
group by ID