Invalid query: Syntax error: Expected keyword JOIN but got keyword DATE

45 views Asked by At

I am trying to establish a connection in Power BI using the Big Query connector and the following error keeps appearing:

DataSource.Error: ODBC: ERROR \[42000\] \[Microsoft\]\[BigQuery\] (70) Invalid query: Syntax error: Expected keyword JOIN but got keyword DATE at \[4:16\]
Detalhes:
DataSourceKind=GoogleBigQuery
DataSourcePath=GoogleBigQuery
OdbcErrors=\[Table\]

Here's part of the code, the complete code has 377 lines and I don't believe there's anything wrong, when I execute direclty on Big Query It works normally:

DECLARE DT DATE DEFAULT '2023-01-01';

WITH

tab_orca as (
select distinct   orcab.ss_num as SS, orcab.ss_seq as SS_SEQ, format_date("%d/%m/%Y",orcab.prev_conclusao) as DATA_REF, 'serviço' as TIPO
from     `dados.frota.tf_orcamento` as orcab
where    orcab.ss_seq IN (10,51,52,53,54,55,56,57,58,59) and orcab.sit_cod_aprov IN ('76', '94', '95', '9Z') and date(orcab.orc_data_aprova) >= DT
)

I already filled the billing project ID and the project ID

0

There are 0 answers