Re: select by weekly SUM

2003-07-13 Thread Veysel Harun Sahin
SELECT week, sum(tips) FROM mytable GROUP BY week; [EMAIL PROTECTED] wrote: I have a table of daily information (tips, # of deliveries, etc.). Does anyone know of an easy way using SQL to extract all weekly sums of a field? Like: week 1: sum of tips for that week week 2: sum of tips for that

Re: select by weekly SUM

2003-07-13 Thread Trevor Smith
On Sun, 13 Jul 2003 11:03:21 +0300, Veysel Harun Sahin wrote: SELECT week, sum(tips) FROM mytable GROUP BY week; Sorry, I wasn't clear. I have ONLY daily data, not weekly, but I want to output weekly data. These are the fields I have: date DATE NOT NULL, hours_worked DECIMAL(5,2),

Re: select by weekly SUM

2003-07-13 Thread Veysel Harun Sahin
Then you can use the week function of mysql in group by clause like this: SELECT sum(tips) FROM mytable GROUP BY WEEK(date); This will group your records week by week then will sum each week's tips. Also you can look at http://www.mysql.com/doc/en/Date_and_time_functions.html for the date and

select by weekly SUM

2003-07-12 Thread Trevor Smith
I have a table of daily information (tips, # of deliveries, etc.). Does anyone know of an easy way using SQL to extract all weekly sums of a field? Like: week 1: sum of tips for that week week 2: sum of tips for that week week 3: sum of tips for that week week 4: sum of tips for that week week