General information
Category:
Coding, syntax & commands
I have a table with fields: phone_number, city, state, duration.
The phone_number field is 10 characters, I only need the first 6 of them (area code and prefix).
i need a query that will go through the table of 20 million records and for each phone number that is the same, add up the minutes for that number. this is what i tried:
select state, city, padr((left(phone_number,6)), 10) as phone_num;
sum (bill_dur) as minutes;
order by minutes desc;
from calls_table;
group phone_num
i can not get it to work.
any ideas?
thanks,
Ryan
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only