Reputation: 137
At the moment I'm building a market info query. here's my query:
SELECT
`data`.s AS Simbol,
format( ( (`data`.c - `data`.p) / `data`.p ), 3 ) AS pctChange,
lu
FROM
jos_marketinfo AS `data`
WHERE
`data`.s LIKE '%.%'
ORDER BY pctChange ASC
LIMIT 10
As you see, I'm calculating percentage change in the query and I would like to reorder it. The problem arise that the order is false, I see big negative pctChange value in middle and vice verse.
Am I missing anything?
Upvotes: 0
Views: 209
Reputation: 51765
You should order by without format to avoid alphabetic order and get numeric order:
ORDER BY (data.c-data.p)/data.p
Upvotes: 1