HangTenDesign
asked on
Count total value of an integer field from multiple records
Hello,
I have a field in a table called DAILY_COUNT that holds the value of page hits for a day. The next day a new record is added and begins counting up for that day. How do I write a query that adds up the total of every day into one value.
SELECT TOTAL_OF_ALL_DAYS(daily_co unt) AS page_hits -- ;-)
FROM page_count
WHERE page_id = 1
I have a field in a table called DAILY_COUNT that holds the value of page hits for a day. The next day a new record is added and begins counting up for that day. How do I write a query that adds up the total of every day into one value.
SELECT TOTAL_OF_ALL_DAYS(daily_co
FROM page_count
WHERE page_id = 1
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You are nearly there, you need to use SUM on the integer field
SELECT SUM(daily_count) AS page_hits
FROM page_count
WHERE page_id = 1
SELECT SUM(daily_count) AS page_hits
FROM page_count
WHERE page_id = 1
FROM page_count
WHERE page_id = 1