Commit 7c634afe by lizefeng

优化标签计算的sql

parent c34c5afb
...@@ -1093,27 +1093,19 @@ set session transaction isolation level read uncommitted; ...@@ -1093,27 +1093,19 @@ set session transaction isolation level read uncommitted;
start transaction; start transaction;
-- 清空视图表的数据 -- 清空视图表的数据
Truncate table dc_auto_config_sku_label_temp;
INSERT into dc_auto_config_sku_label_temp(`bailun_sku`,`label`) ( INSERT ignore dc_auto_config_sku_label(`bailun_sku`,`label`) (
select select
t1.bailun_sku, t1.bailun_sku,
( (
case when t1.buyer_name='赵美聪' and t1.source = 1 then '服装精准开发' case when t1.buyer_name='赵美聪' and t1.source = 1 then '服装精准开发'
when t1.buyer_name='赵美聪' then '服装供应商推荐' when t1.buyer_name='赵美聪' then '服装供应商推荐'
when t1.buyer_name!='赵美聪' and t1.source = 1 and t1.create_time>='2019-07-01 00:00:00' then '非服装精准开发' when t1.buyer_name!='赵美聪' and t1.source = 1 and t1.create_time>='2019-07-01 00:00:00' then '非服装精准开发'
when t2.label is null then '未知' else '未知'
else t2.label
end end
) as 'label' ) as 'label'
from dc_base_sku as t1 from dc_base_sku as t1
left join dc_auto_config_sku_label as t2 on t1.bailun_sku = t2.bailun_sku );", commandTimeout: 0);
);
alter table dc_auto_config_sku_label rename dc_auto_config_sku_labelTemp;
alter table dc_auto_config_sku_label_temp rename dc_auto_config_sku_label;
alter table dc_auto_config_sku_labelTemp rename dc_auto_config_sku_label_temp;
truncate table dc_auto_config_sku_label_temp; ", commandTimeout: 0);
_connection.Execute(@"-- 刷新缺货明细表 _connection.Execute(@"-- 刷新缺货明细表
set session transaction isolation level read uncommitted; set session transaction isolation level read uncommitted;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment