How to retrieve values of the same field key for two time series data with a single query?

Hello, if I have two time series data with row protocol format as follows:

Copy code

t0,tag=tagValue field=1 650000000
t1,tag=tagValue field=1 650000000

How can I execute an SQL query to retrieve all columns of these two time series data, and name them as t0.tag, t0.field, t1.tag, and t1.field respectively? Any help would be greatly appreciated!

Welcome!
I think youre going to have to do something like:

SELECT t0.tag AS "t0.tag", 
       t0.field AS "t0.field", 
       t1.tag AS "t1.tag", 
       t1.field AS "t1.field"
FROM t0
INNER JOIN t1 ON t0.time = t1.time
WHERE t0.tag='tagValue' AND t1.tag='tagValue';

Of course assuming both measurements are in the same bucket. and you’ll orbably wanna add a where clause for your time range as well.

Your help has been extremely useful, thank you very much!