	SELECT
		A.`名称`,
		A.编码,
		((A.`商品金额`-B.商品金额)/A.`商品金额`)
	FROM	
	(SELECT 
		V.`期数` AS 期,
		C.`存货编码` AS 编码,
		C.`产品名称` AS 名称,
		SUM(V.`数量`) AS 数量,
		SUM(v.`商品金额`) AS 商品金额,
		C.`来源` AS 源
	FROM 
		zr_product_pkg_vw V 
		LEFT JOIN `产品信息` C ON V.`存货编码` = C.`存货编码` 
	WHERE 
		V.`期数` = 168 GROUP BY C.`存货编码` ORDER BY SUM(v.`商品金额`) DESC) A
		
	LEFT JOIN
		
	(SELECT 
		V.`期数` AS 期,
		C.`存货编码` AS 编码,
		C.`产品名称` AS 名称,
		SUM(V.`数量`) AS 数量,
		SUM(v.`商品金额`) AS 商品金额,
		C.`来源` AS 源
	FROM 
		zr_product_pkg_vw V 
		LEFT JOIN `产品信息` C ON V.`存货编码` = C.`存货编码` 
	WHERE 
		V.`期数` = 167 GROUP BY C.`存货编码` ORDER BY SUM(v.`商品金额`) DESC) B
	 
	 ON A.`编码` = B.`编码`