TICKscript check if var exceeds a dynamic threshold

I started working with InfluxDB and in the progress of joining 2 nodes

Problem
The following code is what I have tried to join 2 nodes.
The expected outcome is to have temperatures:

Time APC1 APC2
18th May 2019 12:00 30 15

However, when I tried out the following code, I got this:

Time APC1 APC2
18th May 2019 12:00 - 15
18th May 2019 12:00 30 -

Here is the code
//Get temperature for UPS APC1

var current_temp1 = batch
    |query('select  mean(value) from icinga2.autogen.apc where (metric = \'PowerNet-MIB::upsAdvBatteryTemperature.0\' and fqdn=\'apc1\')')
        .every(5s)
        .period(10m)
        .groupBy(*)

//Get temperature for UPS APC2

var current_temp2 = batch
    |query('select mean(value) from icinga2.autogen.apc where (metric = \'PowerNet-MIB::upsAdvBatteryTemperature.0\' and fqdn=\'apc2\')')
        .every(5s)
        .period(10m)
        .groupBy(*)

//Joining the 2 vars(current_temp1 and current_temp2)**

current_temp1
|join(current_temp2)
.as(‘apc1’, ‘apc2’)
.tolerance(5m)
.fill(1.0)
|alert()
.crit(lambda: TRUE)
.log(’/tmp/total_temp.log’)

Any advice on how to achieve the expected result?

Thanks!

Here is the output of the log file:
“tags”:{“fqdn”:“apc1”,“metric”:“PowerNet-MIB::upsAdvBatteryTemperature.0”},“columns”:[“time”,“apc1.mean”,“apc2.mean”],“values”:[[“2019-05-28T07:10:00Z”,15,1]]}]}
“tags”:{“fqdn”:“apc2”,“metric”:“PowerNet-MIB::upsAdvBatteryTemperature.0”},“columns”:[“time”,“apc1.mean”,“apc2.mean”],“values”:[[“2019-05-28T07:10:00Z”,1,17]]}]}

The expected result should be:
“tags”:{“fqdn”:“apc1”,“metric”:“PowerNet-MIB::upsAdvBatteryTemperature.0”},“columns”:[“time”,“apc1.mean”,“apc2.mean”],“values”:[[“2019-05-28T07:10:00Z”,15,17]]}]}