--- report.sql 2009/04/10 22:08:06 4 +++ report.sql 2009/04/11 09:33:43 7 @@ -1,3 +1,29 @@ -select ip,count(ip) from log group by ip; +select + count(ip), + ip +from log +group by ip +order by count(ip) desc +limit 10 +; -select * from log order by id desc limit 20 ; +select + count(program), + program +from log +group by program +order by count(program) desc +limit 10 +; + +select + count(facility), + facilities.name +from log +full join facilities on facilities.id = log.facility +group by program,facilities.name +order by count(facility) desc +limit 10 +; + +select * from log order by id desc limit 5 ;