返回顶部

收藏

统计百分比

更多
SELECT
    MerId,
    VenderName,
    ShoppingMonth,
    TotalOrderNumber,
    SuccessOrderNumber,
    TotalPayAmount,
    SuccessTotalPayAmount,
  CASE TotalOrderNumber  
  WHEN 0 THEN '0%'
  ELSE CONVERT(varchar,CONVERT(DECIMAL(10,2),CONVERT(DECIMAL(16,2), SuccessOrderNumber)*1.0/CONVERT(DECIMAL(16,2), TotalOrderNumber)*100 ))+'%'   
  END   AS SuccessRate
FROM
    Vender v
LEFT JOIN GNETE_MER_STAT_MONTHS s ON v.VenderID = s.MerId
WHERE
    ShoppingMonth BETWEEN 201403
AND 201406
AND v.Deleted = 0
GROUP BY
    MerId,
    VenderName,
    ShoppingMonth,
    TotalOrderNumber,
    SuccessOrderNumber,
    TotalPayAmount,
    SuccessTotalPayAmount
ORDER BY
    MerId ASC,
    ShoppingMonth ASC

标签:sql

收藏

0人收藏

支持

0

反对

0

发表评论