MySQL - add totals based on store and group order date by a week/month?

Hi,
is there a way to total `order_total` amounts based on `store_name` and group `order_date` by a week and or month for table below?

Thanks..


CREATE TABLE IF NOT EXISTS `orders_test` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `order_date` datetime NOT NULL default '0000-00-00 00:00:00',
  `status` varchar(20) default 'New',
  `store_name` varchar(200) default NULL,
  `store_id` tinyint(4) default NULL,
  `pickup` enum('Y','N') default 'N',
  `shipping_state` varchar(32) NOT NULL default '',
  `shipping_country` varchar(120) default NULL,
  `order_total` double(8,2) default NULL,
  `discount` decimal(8,2) default '0.00',
  `shipping_cost` decimal(8,2) default '0.00',
  `notified` char(3) default 'No',
  `user_id` int(10) default NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=90 ;

--
-- Dumping data for table `orders_test`
--

INSERT INTO `orders_test` (`id`, `order_date`, `status`, `store_name`, `store_id`, `pickup`, `shipping_state`, `shipping_country`, `order_total`, `discount`, `shipping_cost`, `notified`, `user_id`) VALUES
(68, '2013-07-21 00:00:00', 'PayPal_ok', 'Head Office', 1, 'Y', 'VIC', 'Australia', 2.00, 0.00, 0.00, 'Y', 28),
(69, '2013-07-22 00:00:00', 'New', 'Head Office', 1, 'N', 'SA', 'Australia', 75.91, 0.00, 61.00, 'Y', 28),
(66, '2013-07-18 00:00:00', 'PayPal_ok', 'Head Office', 1, 'Y', 'SA', 'Australia', 2.00, 0.00, 0.00, 'Y', 28),
(67, '2013-07-21 00:00:00', 'New', 'Warehouse', 2, 'N', 'VIC', 'Australia', 39.95, 0.00, 6.95, 'Y', 28),
(70, '2013-07-22 00:00:00', 'New', 'Sydney', 3, 'Y', 'NSW', 'Australia', 16.40, 0.00, 0.00, 'Y', 28),
(71, '2013-07-22 00:00:00', 'New', 'Head Office', 1, 'N', 'QLD', 'Australia', 170.72, 0.00, 88.90, 'Y', 28),
(72, '2013-07-22 00:00:00', 'New', 'Head Office', 1, 'N', 'VIC', 'Australia', 89.18, 0.00, 72.45, 'Y', 28),
(73, '2013-07-21 00:00:00', 'PayPal_ok', 'Head Office', 1, 'Y', 'VIC', 'Australia', 2.00, 0.00, 0.00, 'Y', 28),
(74, '2013-07-22 00:00:00', 'New', 'Head Office', 1, 'N', 'SA', 'Australia', 75.91, 0.00, 61.00, 'Y', 28),
(75, '2013-06-18 00:00:00', 'PayPal_ok', 'Head Office', 1, 'Y', 'SA', 'Australia', 2.00, 0.00, 0.00, 'Y', 28),
(76, '2013-06-24 00:00:00', 'New', 'Warehouse', 2, 'N', 'VIC', 'Australia', 39.95, 0.00, 16.95, 'Y', 28),
(77, '2013-06-24 00:00:00', 'New', 'Sydney', 3, 'Y', 'NSW', 'Australia', 316.40, 0.00, 0.00, 'Y', 28),
(78, '2013-05-24 00:00:00', 'New', 'Head Office', 1, 'N', 'QLD', 'Australia', 170.72, 0.00, 88.90, 'Y', 28),
(79, '2013-07-25 00:00:00', 'New', 'Head Office', 1, 'N', 'SA', 'Australia', 375.91, 0.00, 61.00, 'Y', 28),
(80, '2013-06-18 00:00:00', 'PayPal_ok', 'Head Office', 1, 'Y', 'SA', 'Australia', 2.00, 0.00, 0.00, 'Y', 28),
(81, '2013-06-26 00:00:00', 'New', 'Warehouse', 2, 'N', 'VIC', 'Australia', 9.95, 0.00, 6.95, 'Y', 28),
(82, '2013-06-22 00:00:00', 'New', 'Sydney', 3, 'Y', 'NSW', 'Australia', 316.40, 0.00, 0.00, 'Y', 28),
(83, '2013-05-22 00:00:00', 'New', 'Head Office', 1, 'N', 'QLD', 'Australia', 170.72, 0.00, 88.90, 'Y', 28),
(84, '2013-07-22 00:00:00', 'New', 'Head Office', 1, 'N', 'SA', 'Australia', 35.91, 0.00, 61.00, 'Y', 28),
(85, '2013-06-18 00:00:00', 'PayPal_ok', 'Head Office', 1, 'Y', 'SA', 'Australia', 2.00, 0.00, 0.00, 'Y', 28),
(86, '2013-06-21 00:00:00', 'New', 'Warehouse', 2, 'N', 'VIC', 'Australia', 33.95, 0.00, 6.95, 'Y', 28),
(87, '2013-06-22 00:00:00', 'New', 'Sydney', 3, 'Y', 'NSW', 'Australia', 316.40, 0.00, 0.00, 'Y', 28),
(88, '2013-05-22 00:00:00', 'New', 'Head Office', 1, 'N', 'QLD', 'Australia', 17.72, 0.00, 88.90, 'Y', 28),
(89, '2013-04-22 00:00:00', 'New', 'Head Office', 1, 'N', 'VIC', 'Australia', 89.18, 0.00, 72.45, 'Y', 28);

Open in new window

sabecsAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ArgentiCommented:
select store_name, concat(year(order_date), ' ', monthname(order_date)) as YearMonth, sum(order_total) as TotalOrderStore
from orders_test o
group by store_name, concat(year(order_date), ' ', monthname(order_date)) 
order by store_name, YearMonth

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.