在log日志中已知用户的某一步操作,如何获取其上一步操作?
高洛峰
高洛峰 2016-11-05 12:32:50
0
1
585

公司的日志是记录用户的每一步操作的,to_page ='crhelp'为点击帮助,查询所有点击过帮助的用户进行的所有操作的代码如下:

select date(to_timestamp(dt)),uuid,from_page,to_page
from actionlog
where uuid in (select uuid
from actionlog
where to_page = 'crhelp' and 
date(to_timestamp(dt)) between '2016-09-15' and '2016-09-25')
and date(to_timestamp(dt)) between '2016-09-15' and '2016-09-25'
group by date(to_timestamp(dt)),uuid,from_page,to_page
order by date(to_timestamp(dt))

查询的部分结果为:

1.png

但是这些数据太多,无法查看用户上一步的操作是什么,现在我已知用户的某一步操作为“点击帮助”,那我怎么样才能知道他的上一步操作呢?从数据库中查询应该怎么查询?如果在数据库中无法实现,那在excel中是否可以做到?也就是,已知某一行的数据(to_page='crhelp'),如何知道其上一行的内容?注意不是一行,是所有to_page='crhelp'的上一行。

高洛峰
高洛峰

拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...

répondre à tous(1)
三叔

如果这个表中,有专门的字段记录了,没调,数据的“父ID”,你可以参考PostgreSQL的CTE语法http://www.postgres.cn/docs/9...

如果存储空间不是问题,你希望得到最好的性能可以参考PostgreSQL的专有数据类型ltree。http://www.postgres.cn/docs/9...


Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!