德比是否支持INTERVAL约会

问题描述 投票:0回答:1

我正在Apache Derby上进行性能测试(10.14.2)。我正在使用TPCH基准测试。我已经完成了TPCH的dbgen部分并填充了数据库。 TPCH基准查询中有22个查询。我无法转换第一个查询以适应Apache Derby的语法。在make文件中,我将DB作为DB2。由于那里没有Apache Derby选项。

查询如下:

select
l_returnflag,
l_linestatus,
sum(l_quantity) as sum_qty,
sum(l_extendedprice) as sum_base_price,
sum(l_extendedprice * (1 - l_discount)) as sum_disc_price,
sum(l_extendedprice * (1 - l_discount) * (1 + l_tax)) as sum_charge,
avg(l_quantity) as avg_qty,
avg(l_extendedprice) as avg_price,
avg(l_discount) as avg_disc,
count(*) as count_order
from
    lineitem
where
    l_shipdate <= '1998-12-01' - interval ':1' day (3)
group by
    l_returnflag,
    l_linestatus
order by
    l_returnflag,
    l_linestatus;

来自ij工具的错误:

    ERROR 42X01: Syntax error: Encountered "\':1\'" at line 15, column 47.
Issue the 'help' command for general information on IJ command syntax.
Any unrecognized commands are treated as potential SQL commands and executed directly.
Consult your DBMS server reference documentation for details of the SQL syntax supported by your server.

有没有办法在TPCH中为Apache Derby生成查询。或者可以将查询转换为Apache Derby的工具。

提前致谢。

sql derby
1个回答
1
投票

你可以尝试TIMESTAMPADD()功能:

WHERE l_shipdate <= CAST({fn TIMESTAMPADD(SQL_TSI_DAY, -1, CAST('1998-12-01 00:00:00' AS TIMESTAMP))} AS DATE)
© www.soinside.com 2019 - 2024. All rights reserved.