473,809 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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****@haligoni an.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 5260
machony
1 New Member
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@haligoni an.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
3374
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 selected>Category 1</OPTION> <OPTION VALUE=http://my.domain,.com/cetegory2.html>Category
6
1168
by: @sh | last post by:
Need help again! Here's the head script... ---------------------------------------------------------------------------------------- function Ash_ChangePicFromSelect(TheSource,TheDestination) { value = TheSource.options.value; if (value != '') if (document.images) // document.images.src = value; document.images(TheDestination).src = value; }
6
8340
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 interchange the data's in the select box. (provuide coding for no scrollbar in select box) Thank You in advance
3
2991
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 ? I want to write a javascript function that can
1
9364
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 value="javascript:onCreatePrintable()">Print Map</option> <option value="javascript:onFindLatLong()">Find Lat/Long</option> </select>
0
1099
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 this weekly news digest that you should, or are receiving one when you shouldn't, please alert me through an e-mail reply. QOTW: "exical closures bind to names, default arguments bind to values." - Fredrik Lundh...
6
1138
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 object represents a connection to a service or executable that is running on one computer. Transferring that connection to another computer is impossible." "on't burn bandwith by banal banter, post the examples!" - John Machin See the great...
1
2950
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 --------------Set start and end dates to last 15 days Monthly----------------Set date to first and last day of last month I am not using dtepicker. I have code for monthly statement EndingDate_msk.Text = Format$(DateSerial(Year(Now),...
1
1845
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 Access 03. In the table "weeklytable", i have the following fields WeeklyID WeeklyActivities ProposedActivities WeekNo Date
0
9602
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10639
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10383
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7661
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.