SET @n=0; SELECT a.*,`累计人数`/(SELECT `人数` from app_bi_business_guketongji_all WHERE `顾客分类` LIKE '忠诚顾客') 累计占比 FROM( SELECT a.*,@n := @n + 人数 AS `累计人数` FROM( SELECT * FROM app_bi_business_guketongji_old WHERE 顾客分类 LIKE '忠诚顾客' GROUP BY 日期 )a )a; 我还怎么调整成可识别呢? |