	SELECT
		A.期数,
		A.爱康,
		(A.爱康/(A.爱康+A.理想+A.QJ+A.其他)) AS 爱康比例,
		A.理想,
		(A.理想/(A.爱康+A.理想+A.QJ+A.其他))AS 理想比例,
		A.QJ,
		(A.QJ/(A.爱康+A.理想+A.QJ+A.其他))AS QJ比例,
		A.其他,
		(A.其他/(A.爱康+A.理想+A.QJ+A.其他))AS 其他比例,
		(A.爱康+A.理想+A.QJ+A.其他) AS 合计
	FROM
	(SELECT
		P.PERIOD_NUM AS 期数,
		(SELECT SUM(V1.`商品金额`) AS QJ FROM zr_product_pkg_vw V1 LEFT JOIN `产品信息` C1 ON V1.`存货编码` = C1.`存货编码` WHERE	V1.`期数` = P.PERIOD_NUM AND C1.`来源` = 'QJ') AS QJ,
		(SELECT SUM(V4.`商品金额`) AS 爱康 FROM zr_product_pkg_vw V4 LEFT JOIN `产品信息` C4 ON V4.`存货编码` = C4.`存货编码` WHERE	V4.`期数` = P.PERIOD_NUM AND C4.`来源` = '爱康') AS 爱康,
		(SELECT SUM(V5.`商品金额`) AS 理想 FROM zr_product_pkg_vw V5 LEFT JOIN `产品信息` C5 ON V5.`存货编码` = C5.`存货编码` WHERE	V5.`期数` = P.PERIOD_NUM AND C5.`来源` = '理想') AS 理想,
		(SELECT SUM(V3.`商品金额`) AS 其他 FROM zr_product_pkg_vw V3 LEFT JOIN `产品信息` C3 ON V3.`存货编码` = C3.`存货编码` WHERE	V3.`期数` = P.PERIOD_NUM AND C3.`来源` IS NULL) AS 其他
	FROM
		 ar_period P
		WHERE P.PERIOD_NUM = 168) A