Working for a telephone charging system company, all connections generated by the PBX are billed by the system and stored in a table called cadcha .
cadcha
------------------------------------------
nreg | telefone | ramaldestino | teldata | telpretot
1000 35420000 6050 03/08/2015 2,50
1001 35428790 6050 03/08/2015 1,20
1002 33590000 6050 03/08/2015 2,50
telpretot = connection value.
To make a summation, for example, I already have the following query working:
SELECT SUM(telpretot)
FROM cadcha
WHERE teldata = '08/03/2015'
AND
ramaldestino = '6050';
Now, I would like to know how this same query would look to calculate the statistical fashion, that is, the value that most appeared in the registers of the cadcha table.