mysql - 在log日志中已知用户的某一步操作,如何获取其上一步操作?
黄舟
黄舟 2017-04-17 15:51:15
0
1
687

公司的日志是记录用户的每一步操作的,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))

查询的部分结果为:

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

黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(1)
阿神

If there is a special field recorded in this table, without adjusting the "parent ID" of the data, you can refer to PostgreSQL's CTE syntax http://www.postgres.cn/docs/9...

If storage space is not an issue and you want the best performance, you can refer to PostgreSQL's proprietary data type ltree. http://www.postgres.cn/docs/9...

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template