Hiya.
I'm curious if someone could help me.
I have a web page hit count query with some stats that looks like this:
select DATE_FORMAT(track_time,'%m.%d.%Y') as date_stamp,title,view_count,
truncate((comment_count / view_count),2) as ratio,
round(avg(comment_count)) as comments,
from tracked_pages_data,tracked_pages where
tracked_pages.id = tracked_pages_data.pages_id
and view_count > 0
and (comment_count / view_count) > .005
group by pages_id,DATE_FORMAT(track_time,'%m.%d.%Y')
order by pages_id,track_time desc
Now my boss is telling me I need to show DELTAs for each day. In other words, he wants a column that shows how much the view_count & comment_count increased from one day to the next.
I'm thinking I need to learn some MySQL stored Procedures. Open a cursor, and calculate the field like this:
if (last_record's id = this_record's id) {
delta = this_record's view count - last_record's view_count
}
But I have no clue how to implement this.
Help?