SELECT a.*,DATE_FORMAT(a.t_visit_page_time,'%Y-%m-%d %T') as page_time,r.t_nickName,r.t_city,r.t_sex,r.t_idcard from(select A.*, TIMESTAMPDIFF(SECOND,A.t_visit_page_time,B.t_visit_page_time) sub_seconds,IFNULL(B.t_page_type,0) page_type from( select a.*,(@i := @i + 1) as ord_num from t_user_visit_page_log a,(select @i := 1) d order by t_id ) as A LEFT JOIN ( select a.*,(@j := @j + 1) as ord_num from t_user_visit_page_log a,(select @j := 0) c order by t_id )as B on A.ord_num=B.ord_num and A.t_user_id=B.t_user_id) a LEFT JOIN t_user r ON r.t_id = a.t_user_id where 1=1 and t_system_version LIKE '%iphoneos%'