SELECT C.* FROM (
SELECT DISTINCT B.CUSTOMERID,B.SALE_DATE,B.IDNO,B.AMOUNT_A,
SUM(B.AMOUNT_A) OVER(PARTITION BY B.CUSTOMERID ORDER BY B.IDNO) AMOUNT_B
FROM(
SELECT DISTINCT A.CUSTOMERID,A.SALE_DATE,A.IDNO,SUM(A.AMOUNT) AMOUNT_A
FROM(
SELECT DISTINCT
CUSTOMERID,
SALE_DATE,
DENSE_RANK() OVER(PARTITION BY CUSTOMERID ORDER BY SALE_DATE ) IDNO,
AMOUNT
FROM F_SALE WHERE AMOUNT >=200
ORDER BY CUSTOMERID
) A
GROUP BY A.CUSTOMERID,A.SALE_DATE,A.IDNO
ORDER BY A.CUSTOMERID
)B
GROUP BY B.CUSTOMERID,B.SALE_DATE,B.IDNO,B.AMOUNT_A
ORDER BY B.CUSTOMERID
)C
WHERE MOD(C.IDNO,7)=0
来晚了呀,自己代入下字段,可求连续每7天都大于200的和,
哈哈哈 楼上赞