通过sql case when对商品表自定义属性进行查询,实现行专列效果。 declare @sql varchar(8000)set @sql=select StyleNoselect @sql=@sql+,+[A_GoodsAttr].AttrName+=isnull(max(case AttrName when +[A_GoodsAttr].AttrName+ then AttrValue end),0) from A_
通过sql case when对商品表自定义属性进行查询,实现行专列效果。
declare @sql varchar(8000) set @sql='select StyleNo' select @sql=@sql+','+[A_GoodsAttr].AttrName+'=isnull(max(case AttrName when '''+[A_GoodsAttr].AttrName+''' then AttrValue end),0)' from A_GoodsAttr order by AttrId set @sql=@sql+' from A_ProAttrList where 1=1 and StyleNo=''100010'' group by StyleNo order by StyleNo' print @sql exec(@sql)
1、全部商品自定义属性 2、单货号自定义属性 |