如何检查日志是否连续7天?

时间:2017-03-28 15:23:11

标签: sql sql-server-2008

目的

以下是示例数据格式。我需要在第1,2,3天等等。在每个帐户上。

+------------+----------------+----------------+---------------+--------------+-----+
| m_idPlayer |   Start_Time   |    End_Time    | TotalPlayTime |   account    | SEQ |
+------------+----------------+----------------+---------------+--------------+-----+
|    0000001 | 20170202131759 | 20170202132311 |           312 | developer    |   1 |
|    0000001 | 20170202132351 | 20170202132615 |           144 | developer    |   2 |
|    0000001 | 20170202135834 | 20170202141342 |           908 | developer    |   3 |
|    0000002 | 20170202141645 | 20170202141814 |            89 | runewars21   |   4 |
|    0000003 | 20170202142341 | 20170202142559 |           138 | speedyturtle |   5 |
|    0000004 | 20170202142700 | 20170202142756 |            56 | kevlaire05   |   6 |
|    0000005 | 20170202142915 | 20170202143225 |           190 | infinity13   |   8 |
|    0000003 | 20170202142609 | 20170202143225 |           376 | speedyturtle |   9 |
|    0000002 | 20170202141820 | 20170202143721 |          1141 | runewars21   |  10 |
|    0000001 | 20170202142821 | 20170202143742 |           561 | developer    |  11 |
+------------+----------------+----------------+---------------+--------------+-----+
  • 如果用户已登录并播放特定的总播放时间,我需要检查该记录(例如:第1天 - 需要播放2小时)
  • 同时检查用户是否已连续登录。

帐户为开发人员的预期结果示例

+-----------+---------+-----------+------------+-----------+
| account   | player  | Day 1     | Day 2      | And so on |
+-----------+---------+-----------+------------+-----------+
| developer | 0000001 | 1925 secs | null       |           |
+-----------+---------+-----------+------------+-----------+

0 个答案:

没有答案