[druid-user] ERROR IN QUERY

When i run this query

select * from “countif_data” c1
left join “countif_data” c2 on c2.ID = c1.ID and c1.__time >= c2.__time

shows this error

Error: SQL query is unsupported

Query not supported. Possible error: SQL requires a join with ‘GREATER_THAN_OR_EQUAL’ condition that is not supported. SQL was: select c1.__time from “countif_data” c1 left join “countif_data” c2 on c2.ID = c1.ID and c1.__time >= c2.__time

org.apache.calcite.plan.RelOptPlanner$CannotPlanException

Hello Sachin -

So far druid only supports joins on equality conditions. So the c1.__time >= c2.__time won’t work.
You could do something like

select * from “countif_data” c1
left join “countif_data” c2 on c2.ID = c1.ID
where c1.__time >= c2.__time

although I can’t vouch for the performance of such a join. :slight_smile: