在sql中按组汇总后,显示每个组的前三名就行了!
比如oracle与sql server中语句
WITH RankedSales AS (
SELECT
Category,
Subcategory,
Product,
SUM(SalesAmount) AS TotalSales,
ROW_NUMBER() OVER (PARTITION BY Category, Subcategory ORDER BY SUM(SalesAmount) DESC) AS RowNum
FROM
Sales
GROUP BY
Category,
Subcategory,
Product
)
SELECT
Category,
Subcategory,
Product,
TotalSales
FROM
RankedSales
WHERE
RowNum <= 3
ORDER BY
Category,
Subcategory,
RowNum
标签的js自定义
function() {
var points = this.series.points; //获取当前系列所有的数据点
var total = 0;
var cl = this.categoryArray;
var bl=cl[0]+cl[1];
var sql = "map('"+bl+"','ds5',7,6)";
var value = Number(FR.remoteEvaluate(sql));
if(value <=3){
return this.value;
}
return ""
}