求助:请对视图代码设定变量
/*下面这段视图代码,生成一个视图,我也做成一个“通用查询”窗口了!可以用,但是就只能查商品基本分类(classid like '01013%' )是01013一个品牌,并且是客户表里面的助记符字段(c.code_help)含有“双千”这种客户的周汇总。如果要在通用查询窗口用这个视图,要可以选择“品牌”和“客户表助记符特别字符”,
这段视图代码该怎么改?能不能麻烦帮忙帮忙改一下,很多人说做不到!
*/
IF EXISTS (SELECT * FROM sysobjects WHERE name = 'v_bp_wsale_week' AND type = 'V' )
DROP view v_bp_wsale_week
GO
create view v_bp_wsale_week
as
select datepart(year,a.time_conf) as the_year,datepart(week,a.time_conf) as the_week,
sum(b.value_ok) as value_ok,count(distinct b.shopid) as sku,c.custid,c.name_short,c.zipcode
from t_bp_wsalebrk_h a with(nolock),t_bp_wsalebrk_d b with(nolock) ,
t_bp_cust c with(nolock),t_bp_shop d with(nolock)
where a.bill = b.bill and a.custid = c.custid and b.shopid = d.shopid
and c.code_help like '%双千' --修改客户表助记符特征
and d.classid like '01013%' --修改分类
group by datepart(year,a.time_conf),datepart(week,a.time_conf),c.custid,c.name_short,c.zipcode
go