# Influx 1.8 - Query across Databases

**URL:** <https://community.influxdata.com/t/influx-1-8-query-across-databases/23218>\
**Category:** InfluxQL\
**Tags:** influxdb\
**Created:** [January 4, 2022, 1:21pm UTC](https://community.influxdata.com/t/influx-1-8-query-across-databases/23218 "2022-01-04T13:21:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![meaningoflife](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meaningoflife](https://community.influxdata.com/u/meaningoflife)\
**Post date:** [January 4, 2022, 1:21pm UTC](https://community.influxdata.com/t/influx-1-8-query-across-databases/23218/1 "2022-01-04T13:21:26Z")

</div>

Hi all,

I am still running Influx 1.8, I was wondering if one could do a query across measurements in different databases e.g.

Database(s)  
Sensor1  
Sensor2  
Sensor3

Each of those have a measurement:  
Sensor1 - Total  
Sensor2 - Total  
Sensor3 - Total

I want to query all of these databases read the measurement “Total” and add them all up to get a total of the values across these measurements in different DB’s.

Looking at the documentation I see I can run multiple select statements by using the “;” between the select statements but that gives me individual values so it would just output  
Total=1  
Total=2  
Total=3

What I am trying to get to is “something” like Sensor1 Total + Sensor2 Total + Sensor3 Total = \<Sum\_Value\>

Would someone mind pointing me in the right direction?

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [January 4, 2022, 9:39pm UTC](https://community.influxdata.com/t/influx-1-8-query-across-databases/23218/2 "2022-01-04T21:39:33Z")

</div>

Hello @meaningoflife,  
I believe that if you enable flux, then you might be able to do that with flux. You can’t do that with influxQL. You would have to join the data with Flux.

Something like:

```auto
one = from(bucket:"Sensor1")
|> range(...)
|> filter(fn: (r) => r._measurement == "Sensor1 - Total")

two = from(bucket:"Sensor2")
|> range(...)
|> filter(fn: (r) => r._measurement == "Sensor2 - Total")

three = one = from(bucket:"Sensor3")
|> range(...)
|> filter(fn: (r) => r._measurement == "Sensor3 - Total")

union(tables: [one, two, three])
|> sum() 

```

Or you could use findRecord() instead and extract the single values and then add them together.

> **[Enable Flux | InfluxDB OSS 1.8 Documentation](https://docs.influxdata.com/influxdb/v1.8/flux/installation/)**
>
> Instructions for enabling Flux in your InfluxDB configuration.

---

<div class="post-metadata">

**Author:** ![meaningoflife](https://avatars.discourse-cdn.com/v4/letter/m/858c86/32.png) [@meaningoflife](https://community.influxdata.com/u/meaningoflife)\
**Post date:** [January 5, 2022, 6:39am UTC](https://community.influxdata.com/t/influx-1-8-query-across-databases/23218/3 "2022-01-05T06:39:09Z")

</div>

Thank you @Anaisdg for taking the time to respond. I do have flux enabled on 1.8 never used it. I have been putting off upgrading to 2.x simply due to the volume of data and number of dashboards I have using IQL.

I guess it’s becoming that time to just get it done 🙂

Thank you for the example above will use it once I get the upgrade going.
