SELECT
	B.`会员编号`,
	B.`会员级别`,
	B.PV,
	B.`小业绩`
FROM
(SELECT
	A.`会员编号`,
	A.`会员级别`,
	A.PV,
	A.`小业绩`
FROM
(SELECT
	O.`会员编号`,
	D.LEVEL_NAME AS 会员级别,
	SUM(O.`PV合计`) AS PV,
	VIPXIAOYEJI(O.`会员编号`, 202104) AS 小业绩
FROM
	zr_order_vw O
	LEFT JOIN ar_user U ON U.USER_NAME = O.`会员编号`
	LEFT JOIN ar_declaration_level D ON U.DEC_LV = D.ID
WHERE
	O.`月份` = 202104 AND O.`订单类型` <> '报单'
	GROUP BY O.`会员编号`)A
	)B
	WHERE B.PV >= 300 AND B.`小业绩` >= 9800 AND (B.`会员级别` = '金钻会员' OR B.`会员级别` = 'VIP会员')
	