This message was deleted.
# general
s
This message was deleted.
r
Hi Anoop! Are you trying to do the timeseries query over some time granularity which is producing multiple row results? Or do you have a single row result from the timeseries query?
s
Are you looking for something like this:
Copy code
SELECT "__time"
FROM "kttm-nested-v2-2019-08-25"
WHERE "session_length" = (SELECT MAX("session_length") FROM "kttm-nested-v2-2019-08-25") 
LIMIT 1
an explain of that returns the native query (with the nested timeseries query to get the max):
Copy code
{
  "queryType": "scan",
  "dataSource": {
    "type": "join",
    "left": {
      "type": "table",
      "name": "kttm-nested-v2-2019-08-25"
    },
    "right": {
      "type": "query",
      "query": {
        "queryType": "timeseries",
        "dataSource": {
          "type": "table",
          "name": "kttm-nested-v2-2019-08-25"
        },
        "intervals": {
          "type": "intervals",
          "intervals": [
            "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
          ]
        },
        "granularity": {
          "type": "all"
        },
        "aggregations": [
          {
            "type": "longMax",
            "name": "a0",
            "fieldName": "session_length"
          }
        ],
        "context": {
          "queryId": "eb825977-2bd6-4f5f-ab80-bb2af837b76a",
          "sqlOuterLimit": 1001,
          "sqlQueryId": "eb825977-2bd6-4f5f-ab80-bb2af837b76a",
          "useNativeQueryExplain": true
        }
      }
    },
    "rightPrefix": "j0.",
    "condition": "(\"session_length\" == \"j0.a0\")",
    "joinType": "INNER"
  },
  "intervals": {
    "type": "intervals",
    "intervals": [
      "-146136543-09-08T08:23:32.096Z/146140482-04-24T15:36:27.903Z"
    ]
  },
  "resultFormat": "compactedList",
  "limit": 1,
  "columns": [
    "__time"
  ],
  "legacy": false,
  "context": {
    "queryId": "eb825977-2bd6-4f5f-ab80-bb2af837b76a",
    "sqlOuterLimit": 1001,
    "sqlQueryId": "eb825977-2bd6-4f5f-ab80-bb2af837b76a",
    "useNativeQueryExplain": true
  },
  "granularity": {
    "type": "all"
  }
}
a
{"queryType":"timeseries", "dataSource":"DATASOURCE", "intervals":["2023-05-24T2100/2023 06 01T2059:59"], "granularity":{"type":"period", "period":"PT1H", "timeZone":"UTC"}, "aggregations":[{"type":"doubleMax", "name":"value", "fieldName":"VALUE"}], "context":{"skipEmptyBuckets":"false"}, "filter":{"type":"in", "dimension":"Telemetry", "values":["DBJS1234"]} }
i want to fetch timestamp for this value field in aggregations
if this isn't helpful please be a little more specific about what you're looking for. examples would be helpful