从流水中倒推算出销量为多某值的日期

SELECT rq,spid,chkshl,

(SELECT SUM(chkshl) AS chkshl FROM spls_ck WHERE T.plh <= plh and spid='SPH00009425' having SUM(chkshl)<=10 ) AS chkshl

FROM spls_ck T where spid='SPH00009425'

order by plh desc

你可能感兴趣的:(日期)