So I am coming from years of usage of InfluxQL, but I need to join two tables together, and it doesn’t appear possible without using Flux - can anyone give me a hand in creating a Flux Query?
Currently I am using Influx 1.8.4 and Grafana 7.5.6
I have two tables that can be gathered using the following InfluxQL query
SELECT
"Result",
"E/D" as "U-E/D",
"K/D" as "U-K/D",
"Kills" as "U-Kills",
"SelfHeal" as "U-SelfHeal"
FROM
"Us"
GROUP BY
"Champion", "Match"
Champion | Result | Match | U-E/D | U-K/D | U-Kills | U-SelfHeal |
---|---|---|---|---|---|---|
Barik | Win | 1090121066 | 4.71 | 0.429 | 0.467 | 1304 |
Barik | Win | 1090124021 | 14 | 4 | 0.514 | 2100 |
Barik | Win | 1090125925 | 5.33 | 0.333 | 0.539 | 1920 |
Barik | Win | 1090603552 | 3.571 | 0.286 | 0.46 | 728 |
Barik | Win | 1090876010 | 4.27 | 0.545 | 0.346 | 1708 |
and
SELECT
sum("Kills")/sum("Deaths") as "T-K/D",
(sum("Kills") + sum("Assists"))/sum("Deaths") as "T-E/D",
sum("Kills")/sum("Minutes") as "T-Kills",
sum("SelfHeal")/sum("Minutes") as "T-SelfHeal" ,
FROM
"Them"
WHERE
"Result" = 'Winner'
GROUP BY
"Champion"
which produces a table like this -
Champion | T-K/D | T-E/D | T-Kills | T-Self Healing |
---|---|---|---|---|
Ash | 0.876 | 3.17 | 0.422 | 381 |
Atlas | 0.95 | 3.01 | 0.459 | 568 |
Barik | 1.14 | 4.3 | 0.497 | 1038 |
BombKing | 1.28 | 2.48 | 0.796 | 579 |
At the very minimum I would like a table like this -
Champion | match | Result | U-E/D | T-E/D | U-K/D | T-K/D | U-Kills | T-Kills | U-SelfHeal | T-SelfHeal |
---|---|---|---|---|---|---|---|---|---|---|
Barik | 1090121066 | Win | 4.71 | 4.3 | 0.429 | 1.14 | 0.467 | 0.497 | 1304 | 1038 |
Barik | 1090124021 | Win | 14 | 4.3 | 4 | 1.14 | 0.514 | 0.497 | 2100 | 1038 |
Barik | 1090125925 | Win | 5.33 | 4.3 | 0.533 | 1.14 | 0.539 | 0.497 | 1920 | 1038 |
Barik | 1090603552 | Win | 3.571 | 4.3 | 0.286 | 1.14 | 0.46 | 0.497 | 728 | 1038 |
Barik | 1090876010 | Win | 4.27 | 4.3 | 0.545 | 1.14 | 0.346 | 0.497 | 1708 | 1038 |
Which is all the rows from the first table, filled in with the information about a particular champion from the second table - but ideally, I would like to subtract the two columns “U-" and "T-” to make a combined column out of the difference. So “U-E/D” minus “T-E/D” and “U-K/D” minus “T-K/D” and so forth.
Can anyone give me a hand in accomplishing this?
Thank you