查询具有“timestamp”列的表(epoch时间戳,UTC,毫秒,bigquery表中的类型整数)
我希望能够说: one_week_ago和now之间的时间戳
未指定每个查询中的确切时间戳。 我应该补充一点,我知道以下工作查询:
function fixWords($name)
{
return preg_replace_callback('/\b\w/i', function($matches) {
return ucfirst(strtolower($matches[0]));
}, $name);
}
print fixWords("some name");
# Some Name
print fixWords("some-name");
# Some-Name
但为什么我不能简单地说: function_call1和function_call2之间的时间戳 ?
这些是时间戳的示例:1491544587,1491422047,1491882866,1491881903 1491436515,1491436771,1491436593,1491436621,1491436390,1491436334
https://cloud.google.com/bigquery/docs/reference/legacy-sql https://cloud.google.com/bigquery/docs/reference/standard-sql/
答案 0 :(得分:1)
您可以在标准SQL中说出您想要的内容:
SELECT *
FROM table
WHERE TIMESTAMP_SECONDS(timestamp) BETWEEN
TIMESTAMP_SUB(CURRENT_TIMESTAMP(), INTERVAL 7 * 24 HOUR)
AND CURRENT_TIMESTAMP()