InfluxDB with time companrision with another field from DB

Hi,

I am using influxdb 1.8 and in the select query I read time and newTs as db field represents epoch in ns as below.
But when I add “where time >= newT” clause it does not work.
This throws “ERR: invalid operation: time and *influxql.VarRef are not compatible”

As I understand time is special field, if I add value of newT like where “time >= 1619195400000000000” then it works.

So how can I use variable in the where clause, I have added newTs as integer variable in the database, even I tried newTs::integer in the select query but it fails.

How to solve this problem?

Reference query output

select time, newTs, * from test order by DESC limit 5;

time newTs

1619186823299972608 1619195400000000000
1619185623382094445 1619195400000000000
1619184423460671274 1619195400000000000
1619183223530383327 1619195400000000000
1619182023608563099 1619195400000000000

Can someone please guide me on this, it would be really helpful

@aiuser I don’t know that this type of query is possible with InfluxQL, but it’s totally possible with Flux. Is using Flux an option for you?

Thanks @scott for reply, Flux I need to setup and explore. I am using influxdb 1.8 version.
I am thinking of create new variable from time and use this variable for comparison. But this also did not work because when I say “select time, time as “newT” …” then newT is always blank. Can I have some workaround like this to solve current issue? I would like to avoid the migration to Flux