Mysql 在BigQuery中连接到自身

Mysql 在BigQuery中连接到自身,mysql,google-bigquery,Mysql,Google Bigquery,我有一段在MySQL中运行的代码,但没有在BigQuery中运行 select * from table1 left join table1 as table2 on table1.user_id = table2.user_id and table1.date = table2.date - interval '1 day' 我可能在这里遗漏了一些基本的东西,但我无法找到它。使用 PS.间隔用户手册中未找到数据类型/规范 BigQuery标准SQL现在支持 因此(假设table1.date

我有一段在MySQL中运行的代码,但没有在BigQuery中运行

select *
from table1 
left join table1 as table2
on table1.user_id = table2.user_id
and table1.date = table2.date - interval '1 day'
我可能在这里遗漏了一些基本的东西,但我无法找到它。

使用


PS.
间隔
用户手册中未找到数据类型/规范

BigQuery标准SQL现在支持

因此(假设
table1.date
table2.date
都是日期类型),您只需

select *
from table1 
left join table1 as table2
on table1.user_id = table2.user_id
and table1.date = table2.date - 1

你收到错误信息了吗?为什么引用1天?是的,我在BigQuery中收到一条错误消息。语法错误:[10:58]处出现意外的关键字间隔确定请发布其语法错误:[10:58]处出现意外的关键字间隔BigQuery似乎不支持间隔。尝试替换为DATEADD()。
select *
from table1 
left join table1 as table2
on table1.user_id = table2.user_id
and table1.date = table2.date - 1