[druid-user] SQL Equivalent of Arithmetic Post-Aggregator Division

Hello,

What is the SQL equivalent of the “/” post-aggregator that returns zero on division by zero?

Maybe a CASE statement. Are you translating a Druid query into a SQL query for a different database?

+1, eg:

SELECT CASE col2 WHEN 0 THEN 0 ELSE col1/col2 END FROM myDatabase

1 Like

Are you translating a Druid query into a SQL query for a different database?
No, working druid only. Case statements is how I’m handling it right now. But since the native queries do provide a direct way of handling the division, I was wondering if there was an alias for the same operation in Druid’s SQL that I was missing.

Thank you!