How to summarize weekly totals?

2006-10-28 Thread mos
I can't get my head around this, but I think I should be able to do it 
using just SQL without writing a program.


I have a simple table that looks like:

Rcd_Id: Integer;
Sale_Date: Date;
Sale_Amt: Double;

Each date will have 1 row with the total sales for that day.

and I want to sum 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 
there was a years worth of data, there would be 52 weeks hence 52 rows of 
data would be produced.


Some days may be missing if it is a holiday, which means I can't guarantee 
each week will have a sales row for Monday or Saturday.


Do I need to write a program to do this? Or can it be done with SQL? TIA

Mike

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



utf8 importing problem

2006-10-28 Thread [EMAIL PROTECTED]
I use MySQL database with utf8 character set and utf8_czech_ci 
collation. 
It works well on Linux server but when I try to 
export the data and import into the same database but running on XP machine the 
utf8 is 
gone.Instead of a proper coding there are some strange characters.

I used 
mysqldump --default-character-set=utf8 mimi /home/Result.sql 
to export data to /home/Result.sql file on Linux machine. 
Then I downloaded the file to my XP and here I used 
mysql --default-character-set=utf8 mimi  Result.sql 
to import data. 
Is it correct? 

Any help would be appreciated

L.

--- End of forwarded message ---

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Migrate

2006-10-28 Thread Mohsen Pahlevanzadeh

Dear all,

I have an ubuntu  wiki in that.

Now i export my wiki bank,So i dump a 25MG.

When i import to my target,it dumps just 4K.

My target is RHEL  mysql 4.1.20

Please help me...


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



migrate

2006-10-28 Thread Mohsen Pahlevanzadeh

dear all,

I wanna dump my wiki bank to a RHEL linux,My source bank is in the 
ubuntu Linux.


My target distro has mysql 4.1.20

When i dump from source,It creates a dump 25MG,But when i export it,it 
dump 4k only,I have tested it via phpMyAdmin,Mysql_dump  webmin.


Please help me..

--Mohsen


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: How to summarize weekly totals?

2006-10-28 Thread Peter Brawley




Some days may be missing if it is a holiday, which means I can't

guarantee each week will have a sales row for Monday or Saturday.


Do I need to write a program to do this? Or can it be done with
SQL? TIA


Group by WEEK(sale_date), or build a calendar table and join from it.

PB

mos wrote:
I can't get my head around this, but I think I should be
able to do it using just SQL without writing a program.
  
  
I have a simple table that looks like:
  
  
Rcd_Id: Integer;
  
Sale_Date: Date;
  
Sale_Amt: Double;
  
  
Each date will have 1 row with the total 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 column. It will do this for all the rows in the table.
If there was a years worth of data, there would be 52 weeks hence 52
rows of data would be produced.
  
  
Some days may be missing if it is a holiday, which means I can't
guarantee each week will have a sales row for Monday or Saturday.
  
  
Do I need to write a program to do this? Or can it be done with SQL?
TIA
  
  
Mike
  
  



No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.408 / Virus Database: 268.13.16/504 - Release Date: 10/27/2006



-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]