我需要在宝藏数据中使用临时时间范围表来查询我的SQL查询:
CREATE TEMPORARY TABLE fakehours (Hour BIGINT);
INSERT INTO Hour VALUES (0);
INSERT INTO Hour VALUES (1);
INSERT INTO Hour VALUES (2);
INSERT INTO Hour VALUES (3);
INSERT INTO Hour VALUES (4);
INSERT INTO Hour VALUES (5);
INSERT INTO Hour VALUES (6);
INSERT INTO Hour VALUES (7);
INSERT INTO Hour VALUES (8);
INSERT INTO Hour VALUES (9);
INSERT INTO Hour VALUES (10);
INSERT INTO Hour VALUES (11);
INSERT INTO Hour VALUES (12);
INSERT INTO Hour VALUES (13);
INSERT INTO Hour VALUES (14);
INSERT INTO Hour VALUES (15);
INSERT INTO Hour VALUES (16);
INSERT INTO Hour VALUES (17);
INSERT INTO Hour VALUES (18);
INSERT INTO Hour VALUES (19);
INSERT INTO Hour VALUES (20);
INSERT INTO Hour VALUES (21);
INSERT INTO Hour VALUES (22);
INSERT INTO Hour VALUES (23);
我能在Presto这样做吗?
答案 0 :(得分:3)
Pro tipp,您甚至可以使用WITH
语法在没有临时表的情况下离开。然后在以下SELECT
语句中,您可以使用hours
,就好像它是一个表格一样。
WITH hours AS (SELECT * FROM UNNEST(ARRAY[0,1, ... 22,23]) AS t (hour))
SELECT
*
FROM
hours
;
答案 1 :(得分:3)
我会这样做:
if (window.location.href.indexOf("portfolio.html") !== -1) {
答案 2 :(得分:1)
根据您的Presto版本,尝试:
SELECT * FROM UNNEST(SEQUENCE(0,23))
或
SELECT * FROM UNNEST(ARRAY[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])
在连接中应该达到你想要的效果,而不是Presto中有临时表。