I have a problem getting 'Order By' to work properly on calculated results producing floating point value in MySql.
Ordering by single columns seems to work ok (like 'ORDER BY t2.Col4' in the query below).
This is a stripped version of my query:
Expand|Select|Wrap|Line Numbers
- SELECT t2.Col4, ROUND(SUM(t1.Col1 * t2.Col3) / SUM(t1.Col2), 2)
- FROM Table1 AS t1, Table2 AS t2
- Where t1.Col4 = t2.Col1 ....
- GROUP BY t1.Col3
- ORDER BY ROUND(SUM(t1.Col1 * t2.Col3) / SUM(t1.Col2), 2);
Could it be that I have the formula in the order by expression? If so, how can I specify which rendered column number I want to order by?
Note: do not pay attention to the where clause in this stripped version, in my unstripped version the where clause is complete and the rendered values are as expected.
best regards
Kurt