你会如何解析(这是一个简单的例子):${table_1} + ${table_2} + ${table_3}
并生成一个SQL查询,如:
WITH
TMP_1 AS (SELECT date, quantity FROM table_1),
TMP_2 AS (SELECT date, quantity FROM table_2),
TMP_3 AS (SELECT date, quantity FROM table_3)
SELECT time_bucket('1 day', date) AS date,
sum(quantity) AS sum FROM
(
SELECT date, quantity FROM TMP_1
UNION ALL
SELECT date, quantity FROM TMP_2
UNION ALL
SELECT date, quantity FROM TMP_3
) AS res_1
GROUP BY 1
ORDER BY 1;
您知道任何可以转换为SQL查询的伪语言
更新1
关系可以根据用户输入而变化:${table_1} + ${table_2} * ( ${table_3} * 60 )
答案 0 :(得分:0)
您可以使用sql本身:
id