Ticket #87 (new defect)
Opened 14 years ago
产品库经销商展示数据修正
| Reported by: | liaojunqiang | Owned by: | |
|---|---|---|---|
| Priority: | major | Milestone: | |
| Component: | 网友前台 | Version: | |
| Keywords: | Cc: | ||
| Due Date: | 07/03/2012 |
Description
1.问题
需求报障,产品库经销商展示数据与商城其页面显示数据显示不一致;
2.调查
产品库经销商展示数据是由一个定时任务的sql脚本生成的,
3.分析
修改前:
update pdl_product a set a.EYP_PRICE_COUNT=(select b.company_count from ( SELECT product_id, count(*) as company_count FROM V_ENT_PRODUCT group by product_id) b where b.product_id= a.id) where exists (select 1 from v_ent_product c where a.id=c.product_id);
根据商城经销商展示规则,以上的sql语句的条件写的不够,没有关联商家够买服务的表和产品库商家信息表
4.解决
修改后:
insert into tmp_company_count Select a.product_id,Count(*) as company_count
From V_ENT_PRODUCT a,
( Select COMPANY_ID,BRAND_ID
From PP_AD
Union
Select COMPANY_ID,BRAND_ID
From PDL_AD
) b ,
ENT_COMPANY c,
V_PDL_PRODUCT d,
V_PDL_PRODUCT_TYPE e
Where b.brand_id = e.id
And e.id = d.type_id
And d.id = a.product_id
And a.user_id = c.id
And c.vip_rank=3
And c.status >=0
And c.id = b.company_id
And c.price_area_id Is Not Null
Group By a.product_id;
update pdl_product a set a.EYP_PRICE_COUNT=(select b.company_count from tmp_company_count b
where b.product_id= a.id)
where exists (select 1 from v_ent_product c where a.id=c.product_id);
新建了个临时表,因为读数据的时间比较长,会对产品库的表造成堵塞,所以直接从临时表写数据到产品库的表,update语句就不用等select语句做完再更新,时间会快一点
Note: See
TracTickets for help on using
tickets.
![(please configure the [header_logo] section in trac.ini)](http://www1.pconline.com.cn/global/2008/images/jss/m_logo091125.jpg)