I have a table called cadcha (call register) in the database where all the calls made by the employees of a certain company are stored.
cadcha
--------------------------------------------------
nreg |telefone |telpretot |ramaldestino
1110 35420000 0,79 5065
telpretot = connection value
I made a query that brings the fashion statistic by the value of the connections, and needed that it be ordered by the decreasing amount, that is, the record with the larger quantity, comes first.
SELECT COUNT(telpretot) AS qtde,
(CAST(telpretot AS DECIMAL(18,0))) as preco
FROM cadcha
WHERE teldata = '08/03/2015'
GROUP BY (CAST(telpretot AS DECIMAL(18,0)))
ORDER BY qtde DESC;
It works fine, however, the ordered record is returned from the smallest to the largest. I've already tried to change DESC to ASC but the result displayed is the same.
How can I correct the script so that records are sorted from highest to lowest?