Combine multiple queries result into one row with influxdb

HI.

I want to create a table, where columns show mean of different elapsed period (e.g., 15m value, 24h value).

The sample data I have in the influxdb is:

time				name	value1

2018-04-09T01:17:55.350626995Z h1 75
2018-04-09T01:18:16.367848326Z h2 100
2018-04-09T01:18:37.58407287Z h1 80
2018-04-09T01:19:06.782059636Z h2 110
2018-04-09T14:26:16.544766547Z h2 100
2018-04-09T14:26:30.16684856Z h1 107
2018-04-09T15:18:37.565655114Z h1 109
2018-04-09T15:22:22.741058316Z h1 110
2018-04-09T15:56:13.99190576Z h1 120
2018-04-10T01:30:12.423603418Z h1 110
2018-04-10T01:30:18.622412897Z h2 115

The expected table output is:

Name 15m_value1 24H_value1
h1 a0 a1
h2 a2 a3

where
a0 = SELECT mean("value1") FROM "log" WHERE ("name" = 'h1') AND time >= now() - 15m
a1 = SELECT mean("value1") FROM "log" WHERE ("name" = 'h1') AND time >= now() - 24h
a2 = SELECT mean("value1") FROM "log" WHERE ("name" = 'h2') AND time >= now() - 15m
a3 = SELECT mean("value1") FROM "log" WHERE ("name" = 'h2') AND time >= now() - 24h