oracle8.1.6
select min(u.last_name || ', ' || u.first_names) as user_name,
min(u.email) as email,
d.user_id,
count(*) as num_downloads,
min('$downloaded') as downloaded
from download_downloads_repository d, cc_users u
where d.repository_id = $repository_id and
d.user_id = u.user_id
[ad_dimensional_sql $dimensional where]
group by d.user_id
order by 2 desc
d.download_date + 1 > SYSDATE
d.download_date + 7 > SYSDATE
d.download_date + 30 > SYSDATE