MySQL:
SELECT
corp_id,
corp_user_id,
SUM(totalxx_num) totalxx_num,
SUM(total_xxx_num) total_xxx_num
from xxx.xxxx
where corp_id = 'sdd' and dept_id = 100 and send_day >= '2023-03-01 00:00:00'and send_day
CK:
SELECT
corp_id,
corp_user_id,
SUM(totalxx_num) totalxx_num,
SUM(total_xxx_num) total_xxx_num
from xxx.xxxx
where corp_id = 'sdd' and dept_id = 100 and send_day >= toDate('2023-03-01 00:00:00') and send_day
DDL:
create table xxxx
(
id Int64,
corp_id String,
user_id Int64,
corp_user_id String,
totalxx_num Int32,
total_xxx_num Int32,
send_day Date
)
engine = MergeTree PARTITION BY toMonday(send_day)
PRIMARY KEY id
ORDER BY (id, corp_id, user_id, send_day)
SETTINGS index_granularity = 8192;