Good day,
I have a table mysql as folowing:
+----+--------+---------------------+------+
| id | userid | fecha_ingreso | tipo |
+----+--------+---------------------+------+
| 1 | 1 | 2015-06-08 20:00:00 | 1 |
| 3 | 1 | 2015-06-09 05:00:00 | 2 |
| 18 | 2 | 2015-06-09 23:30:00 | 1 |
| 19 | 2 | 2015-06-10 05:00:00 | 2 |
| 20 | 2 | 2015-06-10 06:00:00 | 1 |
| 21 | 2 | 2015-06-10 09:00:00 | 2 |
| 22 | 1 | 2015-06-09 23:30:00 | 1 |
| 23 | 1 | 2015-06-10 05:00:00 | 2 |
| 24 | 1 | 2015-06-10 06:00:00 | 1 |
| 25 | 1 | 2015-06-10 09:00:00 | 2 |
+----+--------+---------------------+------+
10 rows in set
This table has information of every user (userid) who into the work and out of the work (fecha_ingreso). For example with userid=1 has enter (tipo=1) at 2015-06-08 20:00 and hes left the job at 2015-06-09 05:00:00. Then i have the userid=2 who is entered (tipo=1) to job at 2015-06-09 23:30:00 (nighttime) and he left (tipo=2) job for breadfat at 2015-06-10 05:00:00 and he entered again at 2015-06-10 06:00 and he finally left job at 2015-06-10 09:00:00.
Im not able to make a query that only shows me something like this:
+----+--------+---------------------+------+
| id | userid | fecha_ingreso | tipo |
+----+--------+---------------------+------+
| 1 | 1 | 2015-06-08 20:00:00 | 1 |
| 3 | 1 | 2015-06-09 05:00:00 | 2 |
| 1 | 2 | 2015-06-09 23:00:00:| 1 |
| 1 | 2 | 2015-06-10 09:00:00 | 2 |
| 1 | 1 | 2015-06-09 23:30:00 | 1 |
| 1 | 1 | 2015-06-10 09:00:00 | 2 |
Aucun commentaire:
Enregistrer un commentaire