我有这个查询,我想在avg上使用desc命令:
select Nomcircuit, avg(Monuments.NBETOILE) as TotalEtoiles from Circuits
inner join CircuitsMonuments on Circuits.Idcircuit = CircuitsMonuments.Idcircuit
inner join Monuments on Monuments.Idmonument = CircuitsMonuments.Idmonument
group by Nomcircuit;
我尝试了几件事,但它似乎没有效果。
答案 0 :(得分:1)
按照你的建议做:
SELECT Nomcircuit,
AVG(Monuments.NBETOILE) AS TotalEtoiles
FROM Circuits
INNER JOIN CircuitsMonuments
ON Circuits.Idcircuit = CircuitsMonuments.Idcircuit
INNER JOIN Monuments
ON Monuments.Idmonument = CircuitsMonuments.Idmonument
GROUP BY Nomcircuit
ORDER BY TotalEtoiles DESC