How to merge results table into a single one

Hi, you can use group() to group all records into a single table on output.

from(bucket: "traces")
          |> range(start: -1h)
          |> filter(fn: (r) => r["_measurement"] == "traces")
          |> drop(columns: ["_start", "_stop", "result", "table", "_measurement", "source"])
          |> pivot(
            rowKey:["_time"],
            columnKey: ["_field"],
            valueColumn: "_value"
          )
          |> sort(columns: ["_time"])
          // Adding group to end of query to merge all results into a single table for output
          |> group()
2 Likes