TRANSFORM Sum(ccurccc.price) AS [Sum-price]
SELECT ccurccc.cnt, Sum(ccurccc.price) AS [Итоговое значение amnt]
FROM (SELECT ccurdoc.qty AS cnt, ccurdoc.price, ccurgrp.cap
FROM ccurdoc LEFT JOIN ccurgrp ON (ccurdoc.price between ccurgrp.from and ccurgrp.till)
) ccurccc
GROUP BY ccurccc.cnt
PIVOT ccurccc.cap;
|