Search code examples
time-seriesinfluxdbinfluxql

Is there a way to specify the field-key when using the INTO statement?


I have the need to combine two measurements into one single measurement for cross-measurement operations, but both of the measurements only have one single field-key "value".

(I know, that this is not a "pretty" Schema Design and I know about Flux query language but I am not allowed to use Beta features in this case.)

Example:

Base Series:

voltage, field-key: "value"=x,<tags>
current, field-key: "value"=x,<tags>

Should become this:

New Series

newMeasurement,field-key: "current"=x,field-key: "voltage"=x, <tags>

I tried SELECT_clause INTO <measurement_name> FROM_clause [WHERE_clause] [GROUP_BY_clause] but I could not achieve the desired result. Is this possible or do I have to re-arrange my schema and rename field-keys?


Solution

  • Did you try
    SELECT value AS current INTO newMeasurement FROM current GROUP BY *
    SELECT value AS voltage INTO newMeasurement FROM voltage GROUP BY *
    ?