how to display cross tab format

how to display cross tab format

jemzjemz Posts: 131Questions: 40Answers: 1

HI @Allan,

Is it possible to display format like this

   
+---------------+------------+------------+
|     TIME      | 2015-10-09 | 2015-10-25 |
+---------------+------------+------------+
| 00:00 - 01:00 |          0 |          0 |
| 01:00 - 02:00 |          0 |          0 |
| 02:00 - 03:00 |          0 |          0 |
| 03:00 - 04:00 |          0 |          0 |
| 04:00 - 05:00 |          0 |          0 |
| 05:00 - 06:00 |          0 |          0 |
| 06:00 - 07:00 |          0 |          0 |
| 07:00 - 08:00 |          0 |          0 |
| 08:00 - 09:00 |          0 |          0 |
| 09:00 - 10:00 |          0 |          0 |
| 10:00 - 11:00 |          0 |          0 |
| 11:00 - 12:00 |          0 |          0 |
| 12:00 - 13:00 |          0 |          0 |
| 13:00 - 14:00 |          0 |          0 |
| 14:00 - 15:00 |          0 |          0 |
| 15:00 - 16:00 |          0 |          0 |
| 16:00 - 17:00 |          0 |          0 |
| 17:00 - 18:00 |          0 |          0 |
| 18:00 - 19:00 |          0 |          0 |
| 19:00 - 20:00 |          1 |          3 |
| 20:00 - 21:00 |          0 |          4 |
| 21:00 - 22:00 |          0 |          4 |
| 22:00 - 23:00 |          0 |          4 |
| 23:00 - 24:00 |          0 |          4 |
+---------------+------------+------------+

This is the data result in my query

   {"data":[{"thedate":"2015-10-09","time_slot":"00:00 - 01:00","thecount":"0"},{"thedate":"2015-10-09"
,"time_slot":"01:00 - 02:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"02:00 - 03:00","thecount"
:"0"},{"thedate":"2015-10-09","time_slot":"03:00 - 04:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"04:00 - 05:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"05:00 - 06:00","thecount":"0"}
,{"thedate":"2015-10-09","time_slot":"06:00 - 07:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"07:00 - 08:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"08:00 - 09:00","thecount":"0"}
,{"thedate":"2015-10-09","time_slot":"09:00 - 10:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"10:00 - 11:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"11:00 - 12:00","thecount":"0"}
,{"thedate":"2015-10-09","time_slot":"12:00 - 13:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"13:00 - 14:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"14:00 - 15:00","thecount":"0"}
,{"thedate":"2015-10-09","time_slot":"15:00 - 16:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"16:00 - 17:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"17:00 - 18:00","thecount":"0"}
,{"thedate":"2015-10-09","time_slot":"18:00 - 19:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"19:00 - 20:00","thecount":"1"},{"thedate":"2015-10-09","time_slot":"20:00 - 21:00","thecount":"0"}
,{"thedate":"2015-10-09","time_slot":"21:00 - 22:00","thecount":"0"},{"thedate":"2015-10-09","time_slot"
:"22:00 - 23:00","thecount":"0"},{"thedate":"2015-10-09","time_slot":"23:00 - 24:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"00:00 - 01:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"01:00 - 02:00","thecount":"0"},{"thedate":"2015-10-25","time_slot":"02:00 - 03:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"03:00 - 04:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"04:00 - 05:00","thecount":"0"},{"thedate":"2015-10-25","time_slot":"05:00 - 06:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"06:00 - 07:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"07:00 - 08:00","thecount":"0"},{"thedate":"2015-10-25","time_slot":"08:00 - 09:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"09:00 - 10:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"10:00 - 11:00","thecount":"0"},{"thedate":"2015-10-25","time_slot":"11:00 - 12:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"12:00 - 13:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"13:00 - 14:00","thecount":"0"},{"thedate":"2015-10-25","time_slot":"14:00 - 15:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"15:00 - 16:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"16:00 - 17:00","thecount":"0"},{"thedate":"2015-10-25","time_slot":"17:00 - 18:00","thecount":"0"}
,{"thedate":"2015-10-25","time_slot":"18:00 - 19:00","thecount":"0"},{"thedate":"2015-10-25","time_slot"
:"19:00 - 20:00","thecount":"3"},{"thedate":"2015-10-25","time_slot":"20:00 - 21:00","thecount":"4"}
,{"thedate":"2015-10-25","time_slot":"21:00 - 22:00","thecount":"4"},{"thedate":"2015-10-25","time_slot"
:"22:00 - 23:00","thecount":"4"},{"thedate":"2015-10-25","time_slot":"23:00 - 24:00","thecount":"4"}
]}
       

Replies

This discussion has been closed.