SELECT SUM(salesamt) from t0006.retailsummary WHERE perioddate between '2012-11-2' and '2013-12-31';
它的作品,但我想(使用日期变量,我指定了startdate=2012-11-1
)
SELECT SUM(salesamt) from t0006.retailsummary WHERE perioddate between startdate and enddate;
它不起作用
答案 0 :(得分:0)
\set startdate '\'' 2012-11-02 '\''
\set enddate '\'' 2013-12-31 '\''
SELECT SUM(salesamt) from t0006.retailsummary WHERE perioddate between :startdate and :enddate;