Objective
Below is the example data format. I need to get the in day 1, 2, 3, and so on.. On each account.
+------------+----------------+----------------+---------------+--------------+-----+
| 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 |
+------------+----------------+----------------+---------------+--------------+-----+
- I need to check on that record if the user has logged in and played with a specific total play time (example: Day 1 – required to play for 2 hours)
- Also check if the user has logged in for the consecutive days.
Example expected results where account is developer
+-----------+---------+-----------+------------+-----------+
| account | player | Day 1 | Day 2 | And so on |
+-----------+---------+-----------+------------+-----------+
| developer | 0000001 | 1925 secs | null | |
+-----------+---------+-----------+------------+-----------+
Best Answer
IMHO your question requires a PIVOT solution.
CTE statment get the sum of seconds grouped by developer and day.
PIVOT part, simply shows this data in columns. Keep in mind you must add all days of one month or deal with a dynamic query.
dbfiddle here
In reference to the second (or main) question:
How to check if logs has 7 consecutive days?
I've used a STD solution, you can find it more by googling a bit.
SQL and contiguous data ranges.
dbfiddle here