有没有一种简单的方法可以获取带有时间戳==昨天的数据? [英] Is there a easy way to get the data with timestamp == yesterday?
本文介绍了有没有一种简单的方法可以获取带有时间戳==昨天的数据?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种简单的方法可以获取带有时间戳==昨天的数据?
Is there a easy way to get the data with timestamp == yesterday?
我只想要昨天的数据.
SELECT
COUNT(t0.user_id) AS t0_qt_AC5uO9oi
FROM
`{something here}` AS t0
WHERE
(t0.event_type = 'XXXXX')
ORDER BY
t0_qt_AC5uO9oi ASC;
不确定什么是最好的方法.
Not sure what is the best way.
推荐答案
以下是BigQuery标准SQL
Below is for BigQuery Standard SQL
#standardSQL
SELECT
CURRENT_DATE() today,
DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY) yesterday
假设您要获取昨天的日期!
然后,当然您需要在查询中分别使用它
Assuming that you are asking for how to get yesterday's date!
Then of course you need to use it in your query respectively
例如
WHERE t0.event_date = DATE_ADD(CURRENT_DATE(), INTERVAL -1 DAY)
这篇关于有没有一种简单的方法可以获取带有时间戳==昨天的数据?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文