Since you have two mutually exclusive WHERE clauses, you cannot accomplish
your goal with one query. InfluxDB does not yet support a HAVING clause or
subqueries.
However, this should be doable with continuous queries, unless I'm missing
something.
CREATE CQ...
select 4*mean("value") AS mean_real INTO "puissance.electricite" from
"puissance.electricite" where station =~ /fmv.hydro.*/ and "typeof" =
'real' group by time(15m)
END
CREATE CQ...
select sum("value") AS sum_forecast INTO "puissance.electricite" from
"puissance.electricite" where station =~ /fmv.hydro.*/ and "typeof" =
'forecast' group by time(15m)
END
Then for your difference query:
SELECT mean_real - sum_forecast FROM "puissance.electricite" WHERE time >
now() - 2w group by time(15m)
On Wed, Aug 24, 2016 at 5:48 AM, wug <[email protected]> wrote:
> Hello,
>
> I am completely new with InfluxDB. I have a database with one measurement
> which has a tag key = station with 4 tag values and a tag key = typeof
> with two tag values: real and forecast. I have values with a period of 1
> minute for the tag value real and values with a period of 15 minute for the
> tag value forecast.
>
> The goal is:
> - First to get series which is the sum on the 4 stations of the values at
> one timestamp.
> - Then for the tag value real do the average on 15 minutes to get 15
> minutes values.
> - Finally do the difference between tag with real and tag with forecast.
>
> Can I do this in one query? If not what is the way to perform that in
> InfluxDB.
>
>
> I did the first 2 steps like that:
>
> for the real tag:
>
> select 4*mean("value") from "puissance.electricite" where station =~
> /fmv.hydro.*/ and "typeof" = 'real' and time < now() and time > now() - 2w
> group by time(15m)
>
>
>
> for the forecast tag:
>
> select sum("value") from "puissance.electricite" where station =~
> /fmv.hydro.*/ and "typeof" = 'forecast' and time < now() and time > now() -
> 2w group by time(15m)
>
>
>
> And I want to do the difference of this 2 queries.
>
>
> I know that kapacitor or continues queries can do these kind of things. I
> tried without success.
>
>
>
> Thank you for your help,
>
>
> wug
>
>
>
> --
> Remember to include the InfluxDB version number with all issue reports
> ---
> You received this message because you are subscribed to the Google Groups
> "InfluxDB" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/influxdb.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/influxdb/d3649745-e6f0-4c77-a4c9-8732bbc2e492%40googlegroups.com
> <https://groups.google.com/d/msgid/influxdb/d3649745-e6f0-4c77-a4c9-8732bbc2e492%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>
--
Sean Beckett
Director of Support and Professional Services
InfluxDB
--
Remember to include the InfluxDB version number with all issue reports
---
You received this message because you are subscribed to the Google Groups
"InfluxDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit
https://groups.google.com/d/msgid/influxdb/CALGqCvPcCKYw%3DnmL0EKWosum5MQ6kqGv8WHDNHNrc-39U%2B5_gg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.