我需要有关查询的一些解释,mysql

时间:2019-06-19 11:05:34

标签: mysql sql

我有一个这样的桌子

select * from table1;
----------------------------------
id|time     |date   |Status  |
1 |07:30:00 |2019-06-19 | 0      |
1 |11:30:00 |2019-06-19 | 1      |
1 |13:00:00 |2019-06-19 | 2      |
1 |16:30:00 |2019-06-19 | 3      |
2 |08:10:00 |2019-06-19 | 0      |
2 |12:03:00 |2019-06-19 | 1      |
2 |13:01:00 |2019-06-19 | 2      |
2 |16:15:00 |2019-06-19 | 3      |

如何查询,这样获得结果

-------------------------------------------------------------------------------------------------------
id|Date       | status=0 as Chekin | status=1 as Breakout| satus=2 as Breakin  | status=3  as Chekout |
1 |2019-06-19 | 07:30:00           | 11:30:00            | 13:00:00            | 16:30:00             |
2 |2019-06-19 | 08:10:00           | 12:03:00            | 13:01:00            | 16:15:00             |
3 |next record| next record        | next record         | next record         | next record          |
4 |next record| next record        | next record         | next record         | next record          |
5 |next record| next record        | next record         | next record         | next record          |
6 |next record| next record        | next record         | next record         | next record          |
7 |next record| next record        | next record         | next record         | next record          |
8 |next record| next record        | next record         | next record         | next record          |

0 个答案:

没有答案