weighted average in MySql
<p>I am currently using the following query to get the highest average result:</p>

<pre><code>select ContentType, AVG(Result) as AvgContent from dopractice where S_Id =@S_Id group by ContentType order by 2 desc limit 1; 
</code></pre>

<p>I am trying to modify my query to calculate the highest weighted average. </p>

<p><strong>For example:</strong></p>

<pre><code>((X*1)+(Y*2)+(Z*3))/3
</code></pre>

<p>Is there a way to do this using a single query?</p>

<p><em>Note: the columns in  dopractice table are <code>(Id, StudentId, LessonId, ContentType, result, Date)</code></em></p>