oracle8.1.6
select count(*) as number_clicks, trunc(l.click_time) as day,
p.category_id
from mail_link_clicks l, category_object_map cm, categories c, categories p
where l.link_id = :link_id
and cm.object_id = l.user_id
and cm.category_id = c.category_id
and c.tree_id = :tree_id
and c.parent_id = p.category_id
group by trunc(l.click_time), p.category_id
order by p.category_id, trunc(l.click_time)