select a.id ,b.id ,a.card_num from (select id ,process_time,card_num, @num1 := @num1 + 1 as row_number from (SELECT @num1:=1) r1, you_table_name order by card_num,process_time ) a , (select id ,process_time,card_num, @num2 := @num2 + 1 as row_number from (SELECT @num2:=0) r2, you_table_name order by card_num,process_time) b where a.row_number=b.row_number and a.card_num=b.card_num and b.process_time-a.process_time>1;
SELECT card_num FROM ( SELECT lag(process_time) OVER (PARTITION BY card_num ORDER BY process_time) AS prev_process_time, card_num, process_time FROM your_table ) x WHERE prev_process_time is NULL --not sure whether you need this OR (process_time - prev_process_time > '1 second'::interval)
第 1 页 / 共 1 页
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。