473,324 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

select by weekly SUM

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 5: sum of tips for that week
I can do them one week per query (obviously) but would like one query
that will spit them all out, one after the other.
--
Trevor Smith | tr****@haligonian.com

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/my***********...ie.nctu.edu.tw

Jul 19 '05 #1
1 5232
I was looking into the same thing on the net but was left empty handed, so I decided to fool around with mysql instead and got it working, here's what I wrote:

select * from shopTakings
where week(date)
group by week(date);

'shopTakings' is the name of my table, I only have two columns, one which takes in the takings for the day ( labled 'takings' ) and the other keeping the date. I Hope this helps :)
regards
Jan Hayes, UCC Computer Science

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 5: sum of tips for that week


I can do them one week per query (obviously) but would like one query
that will spit them all out, one after the other.


--
Trevor Smith | trevor@haligonian.com



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=m...ie.nctu.edu.tw
Mar 15 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: John | last post by:
Hi, I have the following code: <FORM> <font size="3">Brands </font><br /> <SELECT SIZE="1" NAME="categorylist" STYLE="font-size: 8pt"> <OPTION VALUE=http://my.domain,.com/cetegory1.html...
6
by: @sh | last post by:
Need help again! Here's the head script... ---------------------------------------------------------------------------------------- function Ash_ChangePicFromSelect(TheSource,TheDestination) {...
6
by: rajesh | last post by:
Is it possible to display the select box without scrollbar in my program there is a need for that . The code attached below contains 2 select box and four buttons and the button is used to...
3
by: veg_all | last post by:
Say I have: <select> <option value='a' > First <option value='b' > Second <option value='c' > Third </select> Is there a way I can access the values First, Second and Third from an array ?...
1
by: Steve M. | last post by:
Hello all. I have a dropdown list: <select name="select" class="mapMenu" onChange="JumpToIt(this)"> <option selected value="none">Select a Tool --</option> <option...
0
by: Cameron Laird | last post by:
ANNOUNCEMENT: we had an incident with backups of the "Python-URL!" mailing list. It's possible we lost one or two transactions from the last week. If you aren't receiving an e-mailed copy of...
6
by: Cameron Laird | last post by:
QOTW: "That is just as feasible as passing a cruise ship through a phone line." - Carsten Haese, on transporting a COM object across a network. Less vividly but more formally, as he notes, "A COM...
1
by: creative1 | last post by:
Hi Everyone, I need help in one more thing. I my report that I want to print under follwoing criteria: Weekly ---------------- Set start and end date automatically to last week Bi-Weekly ...
1
by: associates | last post by:
Hi, I desperately need your help here. I'm trying to work out a better way of producing a weekly report for a job that should show the weekly activities for last week and the current week using...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.