当前位置: 代码迷 >> 综合 >> 【问】删除商品档案
  详细解决方案

【问】删除商品档案

热度:0   发布时间:2024-02-23 11:21:08.0
【问题描述】

商品档案里商品数太多,很多已经没用的了,根据一定的业务时间,彻底删除没业务的商品档案

 

【答】

您好,

可以参考下面语句处理,先查确认后再删,数据可以自行修改,注意备份数据库。

---查询18年后没有发生业务的商品
select * from t_bd_item_info where combine_sta='0' and item_no not in (select item_no from t_im_flow where convert(char(10),oper_date,121)>'2018-01-01')

--查询无误进行删除
delete  t_bd_item_info where combine_sta='0' and item_no not in (select item_no from t_im_flow where convert(char(10),oper_date,121)>'2018-01-01')

 

  相关解决方案