MySQL Forums
Forum List  »  Newbie

Summing values in a table
Posted by: Gordon Tatler
Date: June 28, 2005 06:54AM

I have a myqsl database with a table called domains.

There are separate records for each visitor with the following fields

hits, visits, country_code

I want to generate a query so that I can amalgamate all records containing a specific country code.

At present I am using the following code

"SELECT * from $tbl ORDER BY $mode DESC";

where $tbl is the table name and $mode is either hits or visits.

This works, but each visitor shows as a separate line sorted in descending order by either hits or visits.

Is there any SUM function I could use so that all records from country code (say) 44 are totaled and give only one line ?

Options: ReplyQuote


Subject
Written By
Posted
Summing values in a table
June 28, 2005 06:54AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.