Re: Best method to keep totals

2010-09-06 Thread Tompkins Neil
Just another quick question - following my initial question regarding the best method to keep totals, I wondered if I should adopt a table to record team league standings like based on each result like team_id home_win home_draw home_loss home_goals home_conceded away_win away_draw away_loss

Re: Best method to keep totals

2010-09-04 Thread Neil Tompkins
Thanks for all the useful information. I'm going to ensure the relevant fields are indexed and our db is optimised. On 4 Sep 2010, at 16:10, Arthur Fuller wrote: 100% agreed. Arthur The other exception is also where financial data is being stored. If you have, say, a database containi

Re: Best method to keep totals

2010-09-04 Thread Arthur Fuller
100% agreed. Arthur The other exception is also where financial data is being stored. If you > have, say, a database containing sales order records, then as well as > storing the individual values of each item in each order, you also need to > store the total value of the order, the total price c

Re: Best method to keep totals

2010-09-03 Thread Mark Goodge
On 03/09/2010 16:32, Arthur Fuller wrote: While I agree with the general take on this subject ("Never store totals without a good reason" and "where there is duplication there is the opportunity for skew"), I must say that there are exceptions. A couple of years ago I wo

Re: Best method to keep totals

2010-09-03 Thread Arthur Fuller
While I agree with the general take on this subject ("Never store totals without a good reason" and "where there is duplication there is the opportunity for skew"), I must say that there are exceptions. A couple of years ago I worked on an inherited database in which the operan

Re: Best method to keep totals

2010-09-03 Thread Jangita
query that uses SUM to total the managers points gained for each fixture participated in ? Or should I be looking to have a separate field which is the calculated total for each manager ? Thanks in advance for any advice. Cheers Neil Neil, its generally not a good idea to store totals. I also had

Re: Best method to keep totals

2010-09-02 Thread Jan Steinman
On 2 Sep 10, at 13:58, Jerry Schwartz wrote: >> From: Jan Steinman [mailto:j...@bytesmiths.com] >> >>> From: "Jerry Schwartz" >>> >>> IMNSHO, never store dynamic data in a field unless you absolutely have to. ... >> To do something similar in MySQL, I've used views (which is somewhat clumsy),

RE: Best method to keep totals

2010-09-02 Thread Jerry Schwartz
>-Original Message- >From: Jan Steinman [mailto:j...@bytesmiths.com] >Sent: Thursday, September 02, 2010 1:52 PM >To: mysql@lists.mysql.com >Subject: RE: Best method to keep totals > >> From: "Jerry Schwartz" >> >> IMNSHO, never store dynamic

RE: Best method to keep totals

2010-09-02 Thread Jan Steinman
> From: "Jerry Schwartz" > > IMNSHO, never store dynamic data in a field unless you absolutely have to. I agree, and yet, it's so darned handy if it's a calculation you need quite often. In FileMaker Pro (hold the "boos," please :-) you can have calculated fields -- a "pseudo field" that hold

Re: Best method to keep totals

2010-09-01 Thread Tompkins Neil
Thanks for your quick response. So like I thought, I'll just calculate the totals on the fly and like you mentioned the manager is going to participate in 50 games per season, with a season being twice per year. Thanks for the help. Neil On Wed, Sep 1, 2010 at 10:06 PM, Jerry Schwartz

RE: Best method to keep totals

2010-09-01 Thread Jerry Schwartz
d 195 Farmington Ave. Farmington, CT 06032 860.674.8796 / FAX: 860.674.8341 E-mail: je...@gii.co.jp Web site: www.the-infoshop.com >-Original Message- >From: Tompkins Neil [mailto:neil.tompk...@googlemail.com] >Sent: Wednesday, September 01, 2010 4:29 PM >To: [MySQL] >Subject: Best m

Best method to keep totals

2010-09-01 Thread Tompkins Neil
Hi, I'm developing a system whereby a manager gets assigned points based a certain number of factors which are saved alongside a football result. However, I also want to keep a total for each manager. My question is it best to just have a query that uses SUM to total the managers points gained f

Re: How to Get Running Totals.

2010-05-02 Thread Peter Brawley
>I am trying to get running totals See "Running sum" at http://www.artfulsoftware.com/infotree/queries.php. PB - Venugopal Rao wrote: I am trying to get running totals for the following: Project Code---R&D---STP--RunningTotal 1007303--04---04---8 1007304

How to Get Running Totals.

2010-05-02 Thread Venugopal Rao
I am trying to get running totals for the following: Project Code---R&D---STP--RunningTotal 1007303--04---04---8 1007304--04---04---16   I tried to follow the examples available on the site but it is giving errors. I am using java as a middleware and mysql as back end.

Re: Query for rolling totals

2009-09-03 Thread John Daisley
Thank you Brent, much appreciated! On Thu, 2009-09-03 at 14:12 -0400, Brent Baisley wrote: > You can do this using a variable. Set the variable starting value with > a "query": > set @runningTotal := 0 > > Then add the calculation to your total: > SELECT a. trans_id ,a.tran_date,b.cat_type,a

Re: Query for rolling totals

2009-09-03 Thread Brent Baisley
You can do this using a variable. Set the variable starting value with a "query": set @runningTotal := 0 Then add the calculation to your total: SELECT a. trans_id ,a.tran_date,b.cat_type,a.payee,a.amnt, @runningTotal := @runningTotal+a.amnt AS rollingTotal from transactions a join categories b on

Query for rolling totals

2009-09-03 Thread John Daisley
Hi, Hoping someone can help me with this little issue! It seems really simple but my brain is refusing to work. We have a transactions tables like so... mysql> desc transactions; +---+--+--+-+-++ | Field | Type | Nul

Re: How to summarize weekly totals?

2006-10-28 Thread Peter Brawley
sales for that day. and I want to sum the weekly totals so it looks like: WeekEnding    TotalAmt 2006-10-14    3899.34 2006-10-21  222.12 2006-10-28  33122.12 So for each week, it will sum the sales for Monday through Saturday and provides a total colu

How to summarize weekly totals?

2006-10-27 Thread mos
m the weekly totals so it looks like: WeekEndingTotalAmt 2006-10-143899.34 2006-10-21 222.12 2006-10-28 33122.12 So for each week, it will sum the sales for Monday through Saturday and provides a total column. It will do this for all the rows in the table. If ther

Re: Running Totals?

2006-08-04 Thread Barry Newton
d) Month, Year(DatePaid) Year, count(*) as Registrations, Extract(Year_Month from DatePaid) Monindex, Sum(Amount) as Paid From Capclavepresent where ( amount > 0) Group by Monindex; /* REPORT FOR BOTH YEARS WITH RUNNING TOTALS*/ Set @cumreg=0, @cumr

Re: Running Totals?

2006-08-03 Thread Barry Newton
At 04:15 PM 8/3/2006, Brent Baisley wrote: You might look into WITH ROLLUP. That could easily give you cumulative totals for the year, but off the top of my head I can't think of a way to get it for the months. - Original Message - From: "Barry Newton" <[EMAIL PRO

Re: Running Totals?

2006-08-03 Thread Brent Baisley
You might look into WITH ROLLUP. That could easily give you cumulative totals for the year, but off the top of my head I can't think of a way to get it for the months. - Original Message - From: "Barry Newton" <[EMAIL PROTECTED]> To: Sent: Wednesday, August 02,

Re: Running Totals?

2006-08-02 Thread Barry Newton
At 11:10 PM 8/2/2006, Peter Brawley wrote: Barry >It would make life easier if I could also show a column >with the cumulative count for each month. Set @cum - 0; Select Monthname(DatePaid) Month, Year(DatePaid) Year, Count(*) as Registrations, Extract(Year_Month from DatePaid

Re: Running Totals?

2006-08-02 Thread Peter Brawley
Barry >It would make life easier if I could also show a column >with the cumulative count for each month.  Set @cum - 0; Select   Monthname(DatePaid) Month,   Year(DatePaid) Year,   Count(*) as Registrations,   Extract(Year_Month from DatePaid) AS Monindex,   @cum := @cum + Count(*) AS

Running Totals?

2006-08-02 Thread Barry Newton
Back with another registration db question: Have a convention database which tracks people as they register all year long; the actual convention is held in October. I've got a fairly simple query which shows how many people registered in each calendar month--useful to compare to prior year to

Re: Cumulative Totals

2006-07-10 Thread Gabriel PREDA
"cumulative total index" ... > > >SELECT SUM(amount) , DATE_FORMAT( `paymentDate` , '%Y-%m' ) FROM > > >`payments` GROUP BY DATE_FORMAT( payments . date , '%Y-%m' ) . > > >Is there any way to get a running cumulative total directly from mysql? > > >Something like: > > > > > >amount | pay

Re: Cumulative Totals

2006-07-09 Thread Frederik Eaton
; >1| 123| 2005-01-10 > > >2| 77 | 2005-01-13 > > >3| 45 | 2005-02-16 > > >4| 13 | 2005-02-17 > > > > > > > > >I can get totals per month using a query like: > > > > > >SELECT SUM(amount) , DATE_FORMAT( `pay

RE: colum totals

2005-09-16 Thread Tony Leake
On Fri, 2005-09-16 at 14:02 +0100, Mark Leith wrote: > http://dev.mysql.com/doc/mysql/en/group-by-modifiers.html > perfect, thank you. tony -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]

RE: colum totals

2005-09-16 Thread Mark Leith
t; Sent: 16 September 2005 13:19 > To: mysql@lists.mysql.com > Subject: colum totals > > Hi, > > I'm sure I read somewhere about a new function that would > give the totals of all columns, ie if i have 2 cols, > numberOfOrders valueOfOrders for a range of dates i can get > so

colum totals

2005-09-16 Thread Tony Leake
Hi, I'm sure I read somewhere about a new function that would give the totals of all columns, ie if i have 2 cols, numberOfOrders valueOfOrders for a range of dates i can get something like the following Date numberOfOrdersvalueOfOrders 01-09 4 20.00 02-09

Re: Totals Across Multiple Records

2005-07-23 Thread Albert Padley
Sol and Peter, Thanks for your feedback. Both of your suggestions got me going in the right direction and I was able to solve the problem using temporary tables and left joins. Thanks again. Albert Padley On Jul 23, 2005, at 11:00 AM, sol beach wrote: create table count_temp1 select i

Re: Totals Across Multiple Records

2005-07-22 Thread Peter Brawley
Albert, Your spec isn't entirely clear to me (eg if sd1 & sd2 were 'unique within each record', wouldn't there be zero rows where sd1=sd2?), but is this what you're looking for ... SELECT zz, COUNT(zz) as zzCount, SUM(IF(zz=sd1 AND sd1=sd2, 1, 0)) AS sd1sd2Count FROM ss GROUP BY zz; Peter

Totals Across Multiple Records

2005-07-22 Thread Albert Padley
I would be grateful if those of you around this weekend could help me figure out if what I'm after is possible. I've already spent hours with the manual, the archives and my books. I've looked at JOINS and TEMP TABLES but still can't come up with a solution. THE ENVIRONMENT: MySQL Version

Re: Cumulative Totals

2005-05-27 Thread doug
005, Russell Horn wrote: > > >I have a pretty simple table with a list of payments, not much more > >than: > > > >paymentID | amount | paymentDate > >1 | 123| 2005-01-10 > >2 | 77 | 2005-01-13 > >3 | 45 | 2005-02-16 > >4

Re: Cumulative Totals

2005-05-25 Thread mfatene
Hi again, if your looking for raising sub-totals, i found you thos form : mysql> select 'TOTAL', -> sum(if(DATE_FORMAT( `paymentDate` , '%Y-%m' )<='2005-01',amount,0)) as '2005-01', -> sum(if(DATE_FORMAT( `paymentDate` , '%Y-%m&#

Re: Cumulative Totals

2005-05-25 Thread mfatene
: > Sent: Wednesday, May 25, 2005 8:02 AM > Subject: Cumulative Totals > > > > I have a pretty simple table with a list of payments, not much more > > than: > > > > paymentID | amount | paymentDate > > 1 | 123| 2005-01-10 > > 2 | 77 | 2005-01

Re: Cumulative Totals

2005-05-25 Thread Rhino
- Original Message - From: "Russell Horn" <[EMAIL PROTECTED]> To: Sent: Wednesday, May 25, 2005 8:02 AM Subject: Cumulative Totals > I have a pretty simple table with a list of payments, not much more > than: > > paymentID | amount | paymentDate > 1 |

Re: Cumulative Totals

2005-05-25 Thread Brent Baisley
st of payments, not much more than: paymentID | amount | paymentDate 1 | 123| 2005-01-10 2 | 77 | 2005-01-13 3 | 45 | 2005-02-16 4 | 13 | 2005-02-17 I can get totals per month using a query like: SELECT SUM(amount) , DATE_FORMAT( `paymentDate` , &

Re: Cumulative Totals

2005-05-25 Thread Dan Bolser
005-02-17 > > >I can get totals per month using a query like: > >SELECT SUM(amount) , DATE_FORMAT( `paymentDate` , '%Y-%m' ) FROM >`payments` GROUP BY DATE_FORMAT( payments . date , '%Y-%m' ) > >That would give me: > >amount | paymentDat

Cumulative Totals

2005-05-25 Thread Russell Horn
I have a pretty simple table with a list of payments, not much more than: paymentID | amount | paymentDate 1 | 123| 2005-01-10 2 | 77 | 2005-01-13 3 | 45 | 2005-02-16 4 | 13 | 2005-02-17 I can get totals per month using a query like: SELECT SUM

Re: problem with totals doubling when using a right join....

2004-06-02 Thread SGreen
y" <[EMAIL PROTECTED]> com> Fax to: Subject: problem

problem with totals doubling when using a right join....

2004-06-02 Thread Andrew Braithwaite
Hi All, I have a problem. I have 2 tables: mysql> SELECT int_traffic.day, sum(int_traffic.deliveries) as deliveries -> FROM int_traffic -> WHERE int_traffic.day between '2004-05-01' and '2004-05-31' -> GROUP BY int_traffic.day -> ORDER BY int_traffic.day; ++--

Re: Totals

2004-03-24 Thread Paul DuBois
At 10:19 -0800 3/24/04, Craig Gardner wrote: I need to get totals for the data in my database. I stumbled upon the "WITH ROLLUP" modifier (http://www.mysql.com/doc/en/GROUP-BY-Modifiers.html) and it appears to be exactly what I'm looking for, except for the fact that when I

Totals

2004-03-24 Thread Craig Gardner
I need to get totals for the data in my database. I stumbled upon the "WITH ROLLUP" modifier (http://www.mysql.com/doc/en/GROUP-BY-Modifiers.html) and it appears to be exactly what I'm looking for, except for the fact that when I try to use it I get the following message:

running totals

2002-08-17 Thread Todd Schacherl
Hi Folks, I'm using the following SQL SELECT statement to query a list of labor items. I'm able to compute my number of hours(thanks Paul) and the line amount (hours*rate=lineTotal) and now what I would like to do is to keep a running total for hours and lineTotal. Is there any way I can do that

Re: getting totals with data

2002-06-18 Thread Erik Price
On Monday, June 17, 2002, at 05:44 PM, Galen Wright-Watson wrote: > Another option is to SELECT INTO a temporary table (or CREATE > TEMPORARY ... > SELECT), then query the temporary table for the total_hits. Would the overhead of generating a temporary table for this query be worthwhile? I'

RE: row totals

2002-04-09 Thread Craig Vincent
> I need to know how many total reviews are in my table for each category > name, im using this query and it doesn't work: > > SELECT SUM(name) AS articletotal WHERE category = 'Processors' Try SELECT count(name) AS articletotal FROM tablename WHERE category = 'Processors' Sincerely, Craig Vi

row totals

2002-04-09 Thread Alex Behrens
Hey Guys, What is the command to add up the amount of rows in a total? I need to know how many total reviews are in my table for each category name, im using this query and it doesn't work: SELECT SUM(name) AS articletotal WHERE category = 'Processors' mysql Thanks! --

Re: Getting totals from database

2001-01-27 Thread pferraro
Eric, Thank you for the information! It works fine! I did go to the page below, but it was for Mathematical EQUATIONS, like syne,radius, circum, etc... I looked under all of those pages and never really saw and reference to simply pulling totals out. I really appreciate it! It

Re: Getting totals from database

2001-01-26 Thread Eric Fitzgerald
CTED]> Sent: Friday, January 26, 2001 3:00 PM Subject: Getting totals from database > > I know this is probably a simple thing, but what I would like to > be able to do, is to query a specific account name for minutes each day > and then have those minutes ADDED up to show the cur

Getting totals from database

2001-01-26 Thread pferraro
I know this is probably a simple thing, but what I would like to be able to do, is to query a specific account name for minutes each day and then have those minutes ADDED up to show the current total time online. My database has all of the info in the table, all I want to do is be able