-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Description
Search before asking
- I had searched in the issues and found no similar issues.
Version
14.13
What's Wrong?
使用now()查询报错
What You Expected?
success
How to Reproduce?
No response
Anything Else?
CREATE TABLE header (
id bigint(20) NULL COMMENT "",
warehouse_id bigint(20) NOT NULL COMMENT "",
plan_status tinyint(4) NOT NULL COMMENT "",
is_deleted bigint(20) NOT NULL DEFAULT "0" COMMENT "",
update_time datetime NULL COMMENT "更新时间"
) ENGINE=OLAP
UNIQUE KEY(id, warehouse_id)
COMMENT "OLAP"
DISTRIBUTED BY HASH(warehouse_id) BUCKETS 16
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);
CREATE TABLE detail (
id bigint(20) NOT NULL COMMENT "",
warehouse_id bigint(20) NOT NULL COMMENT "",
header_id bigint(20) NOT NULL COMMENT "",
sku_id bigint(20) NOT NULL COMMENT "",
forecast_qty decimal(20, 3) NOT NULL DEFAULT "0.000" COMMENT "",
expect_qty decimal(20, 3) NOT NULL DEFAULT "0.000" COMMENT "",
is_deleted bigint(20) NOT NULL DEFAULT "0" COMMENT ""
) ENGINE=OLAP
UNIQUE KEY(id, warehouse_id)
COMMENT "OLAP"
DISTRIBUTED BY HASH(warehouse_id) BUCKETS 16
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);
CREATE TABLE demand (
id bigint(20) NULL COMMENT "",
warehouse_id bigint(20) NOT NULL COMMENT "",
plan_id bigint(20) NOT NULL COMMENT "",
demand_id bigint(20) NOT NULL COMMENT ""
) ENGINE=OLAP
UNIQUE KEY(id, warehouse_id)
COMMENT "OLAP"
DISTRIBUTED BY HASH(warehouse_id) BUCKETS 16
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);CREATE TABLE sku_warehouse (
id bigint(20) NOT NULL COMMENT "",
warehouse_id bigint(20) NOT NULL DEFAULT "0" COMMENT "",
sku_id bigint(20) NOT NULL DEFAULT "0" COMMENT "",
version bigint(20) NOT NULL DEFAULT "1" COMMENT ""
) ENGINE=OLAP
UNIQUE KEY(id, warehouse_id)
COMMENT "OLAP"
DISTRIBUTED BY HASH(warehouse_id) BUCKETS 16
PROPERTIES (
"replication_num" = "3",
"in_memory" = "false",
"storage_format" = "V2"
);
SELECT
pph.warehouse_id ,
ppd2.demand_id ,
pph.id plan_id ,
pph.plan_status ,
sum(ppd.forecast_qty) forecast_qty ,
sum(ppd.expect_qty) expect_qty
FROM
pro_plan_header pph
INNER JOIN pro_plan_detail ppd ON pph.id = ppd.plan_header_id AND pph.warehouse_id = ppd.warehouse_id
INNER JOIN md_sku_warehouse msw ON msw.warehouse_id = ppd.warehouse_id AND msw.sku_id = ppd.sku_id
INNER JOIN pro_plan_demand ppd2 ON pph.id = ppd2.plan_id AND ppd2.warehouse_id = pph.warehouse_id
WHERE
pph.update_time >= '2021-09-30 00:00:00'
AND pph.update_time <= NOW()
AND pph.plan_status = 40
GROUP BY
pph.id ,
pph.warehouse_id ,
ppd2.demand_id ,
pph.plan_status;
Are you willing to submit PR?
- Yes I am willing to submit a PR!
Code of Conduct
- I agree to follow this project's Code of Conduct
