Home > Database > Mysql Tutorial > 统计百分比

统计百分比

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-06-07 14:57:56
Original
1035 people have browsed it

无详细内容 无 SELECTMerId,VenderName,ShoppingMonth,TotalOrderNumber,SuccessOrderNumber,TotalPayAmount,SuccessTotalPayAmount, CASE TotalOrderNumber WHEN 0 THEN '0%' ELSE CONVERT(varchar,CONVERT(DECIMAL(10,2),CONVERT(DECIMAL(16,2), SuccessOrd

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
Copy after login
统计百分比
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template