Difference between the two different timestamp

how can I get the time difference between the two different time stamps column. i.e.
two different measurements have different timestamp column. And I want the difference between that two time stamps.I had studied about elapsed function but it is giving us the difference between the earlier record and the next one.

I’m not sure which version you are using but this is supported in 1.8 and 2.0.

For influxql, you can do a subtraction in the SELECT clause like SELECT "ts1" - "ts2" WHERE ....

See these docs: https://docs.influxdata.com/influxdb/v1.8/query_language/math_operators/#subtraction

Flux language has this capability to with the map method.

Let us know what worked for you!

thanks for the instant reply
I have a question… How can we add 2 time stamp in influxdb… actually I wanna add some extra information regarding time but on searching about it I got “you can a time column by writing unix time at the end of influxql” but the problem is I want two time column with different name and data inside it. Is it possible to add two or more time column?

You can use additional fields to store time data but there is only one timestamp. The timestamp is treated different by the database - there is only one of these. Is sounds like you want two series.

For example:

dataFieldA=1234 timestampA
dataFieldB=9876 timestampB

This is normal.

We don’t usually recommend this:

dataFieldA=1234 dataFieldATimestamp=12:00:00 timestampA

Thanks for clearing my doubt