2
I have a table called cadcha (registration of call) in the database where all calls made by employees of a particular company are stored.
cadcha
--------------------------------------------------
nreg |telefone |telpretot |ramaldestino
1110 35420000 0,79 5065
telpretot = link value
I performed a query that brings the statistic fashion by the value of the links, and needed it to be ordered by the decreasing quantity, ie the record with the largest 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 is working ok, but the order record is returned from minor to major. I have tried to change the DESC to ASC but the displayed result is the same.
How can I fix the script so that the records are ordered from the highest to the lowest?
takes group by and tries again.
– RBoschini
what kind of field
telpretot
?– Marco Souza