select substring_index(URI,'/',1),count(*) from table1 group by substring_index(URI,'/',1) order by 2 desc
select substring_index(substring_index(URI,'/',1),'.',-1),count(*) from table1 group by substring_index(substring_index(URI,'/',1),'.',-1) order by 2 desc
from table1
group by substring_index(URI,'/',1)
order by 2 desc
from table1
group by substring_index(substring_index(URI,'/',1),'.',-1)
order by 2 desc
另外追加个小问题:
数据表 (id UNSIGNED, timestamp UNSIGNED)如果id不存在,将id和当前时间(now)插入表中
如果id存在,更新timestamp为当前时间,并且得到旧的timestamp