Ticket #35: sql.txt

File sql.txt, 2.7 KB (added by chenyinle, 14 years ago)
Line 
1
2#ÇåÀíÉŸ³ý׎̬µÄÉÌÆ·£¬ÒÔŒ°Æä¹ØÁªµÄ±í£¬×Ü14žö±í
3#Ô­ÀíÊÇÒÔÉÌÆ·ÊôÐÔ±í(ent_product_item)Ϊ±ê׌£¬ÏÈÉŸ³ýÆäÊýŸÝ£¬ÔÙ¹ØÁªÆäËû±íÇåÀí£š²»ŽæÔÚ¹ØÁª¹ØÏµµÄÆäËû±íÊýŸÝ»á±»ÇåÀí£©
4#²âÊÔÇåÀí14žö±íʱŒä>2Сʱ
5
6#1¡¢ÉÌÆ·ÊôÐÔ±í(ent_product_item)
7delete from ent_product_item where status=5 and last_update_date<sysdate-interval '30' day
8
9#2¡¢ÉÌÆ·Ö÷±í(ent_product)
10delete from ent_product t where not exists(select 1 from ent_product_item item where item.company_product_id=t.id)
11
12#3¡¢ÉÌÆ·ŒÆÊýÆ÷(ent_company_product_counter)
13delete from ent_company_product_counter t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
14
15#4¡¢ÉÌÆ·ä¯ÀÀŒÇÂŒ(ent_last_view_product)
16delete from ent_last_view_product t where not exists(select 1 from ent_product_item item where item.company_product_id=t.product_id1)
17delete from ent_last_view_product t where not exists(select 1 from ent_product_item item where item.company_product_id=t.product_id)
18
19#5¡¢ÉÌÆ·ÏêÇé(ent_product_detail)
20delete from ent_product_detail t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
21
22#6¡¢ÉÌÆ·ÄÚÈÝÉóºË(ent_product_content_audit)
23delete from ent_product_content_audit t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
24
25#7¡¢ÉÌÆ·ÎïÁ÷·œÊœ(ent_product_logistics)
26delete from ent_product_logistics t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
27
28#8¡¢ÉÌÆ·ÎïÁ÷·ÑÓÃ(ent_product_logistics_detail)
29delete from ent_product_logistics_detail t where not exists(select 1 from ent_product_item item where item.company_product_id=t.product_logistics_id)
30
31#9¡¢É̳ÇÁôÑÔ(ent_question)
32delete from ent_question t where not exists(select 1 from ent_product_item item where item.company_product_id=t.target_id and t.type=1)
33
34#10¡¢ÉÌŒÒÍÆŒöÉÌÆ·(ent_recommend_product)
35delete from ent_recommend_product t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
36
37#11¡¢É̳ǟٱš(ent_report)
38delete from ent_report t where not exists(select 1 from ent_product_item item where item.company_product_id=t.target_id and t.target_type=1)
39
40#12¡¢×Ô¶šÒåÉÌÆ··ÖÀž(ent_shop_homepage_product)
41delete from ent_shop_homepage_product t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
42
43#13¡¢×Ô¶šÒåÉÌÆ··ÖÀà(ent_self_product_type)
44delete from ent_self_product_type t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
45
46#14¡¢œ»Ò×µã»÷ͳŒÆ(ent_trade_stat)
47delete from ent_trade_stat t where not exists(select 1 from ent_product_item item where item.company_product_id=t.company_product_id)
48
49
50
51