I am having an issue running an SQL query in Data Explorer, which uses INNER JOIN
for two tables. The problem starts when a WHERE p_occurs_since('1 DAY')
condition is added, which returns an SQL compilation error similar to the following:
SQL compilation error: ambiguous column name 'P_EVENT_TIME'
To resolve this issue you need to also specify the table alias you wish to use within the macro p_occurs_since(offsetFromPresent [, tableAlias])
.
You can find more information about how our Data Explorer macros work on our documentation page as well as some helpful examples including inner join
statements.
By using INNER JOIN
the SQL uses 2 tables where both include a column with the same name p_event_time
.
As a result, when running the WHERE
statement in the query with the p_occurs_since()
macro, there is a compilation error, since it's not specified which table is responsible for the macro.