我想要一个 SQL 查询
Shop Regio target1 sold1 target2 sold2
shop1 regioA 6 3 10 5
shop2 regioA 4 2 4 2
shop3 regioB 6 0 3 0
shop4 regioC 9 9 8 8
shop5 regioB 8 4 2 1
至
regioC 100%
regioA 50%
regioB 25%
(别管数字,我只是编的)
我尝试使用它,但它没有用:
SELECT regio, SUM((sold2/target1)+(sold2/target2)) AS total
FROM `winkels` GROUP BY `regio` ORDER BY total DESC
任何想法如何使它正确?