When we do QRDS on another query the Datetime column is being considered as text hence not able to filter for a given datetime range on the final query. Please advice.

QRDS uses an in-memory SQLite database. SQLite does not support datetime types in the same way as other ANSI sql databases like postgres or mysql. But you can still work with dates using their built-in Date functions, through CASTs, or in some cases with simply formatted date strings. For example:

-- This is a valid QRDS query that filters by date and time
select * from cached_query_5 where time between '2022-06-25 00:00:00' and '2022-06-26 00:00:00'