There are a table t1
No black white result
Zhang li + 1
2 li zhang -
Three king +
Zhao + 4
Five sun -
6 sun king -
Sun li + 7
There are two queries
SELECT a t1. Black, count (*) as times
The FROM t1
Group by t1. Black;
SELECT a t1. Black, count (*) as wins
The FROM t1
Where the result='+'
Group by t1. Black;
Want to achieve the following effects
Black times wins rates
Lee 2 1 1/2
Sun 2 1 1/2
Zhang 2 3 2/3
Sum 5-7
Rates and sum if the implementation is not can don't
With the UNION to reach effect, touched the along while also didn't touch the PIVOT as a result, to help master