MySQL - need query to provide order totals for each store grouped by year?

I need a query that will give add all "order_total" based on store id for each year?

Thanks in advance for your comments.

  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `mysql_order_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  `order_type` enum('normal','retail','special') DEFAULT 'normal',
  `store_name` varchar(200) DEFAULT NULL,
  `store_id` tinyint(4) DEFAULT NULL,
  `shipping_first_name` varchar(50) NOT NULL DEFAULT '',
  `shipping_last_name` varchar(50) NOT NULL DEFAULT '',
  `shipping_address1` varchar(100) NOT NULL DEFAULT '',
  `shipping_address2` varchar(100) NOT NULL DEFAULT '',
  `shipping_phone` varchar(32) NOT NULL DEFAULT '',
  `shipping_fax` varchar(20) DEFAULT NULL,
  `shipping_city` varchar(100) NOT NULL DEFAULT '',
  `shipping_state` varchar(32) NOT NULL DEFAULT '',
  `shipping_country` varchar(120) DEFAULT NULL,
  `shipping_postal_code` varchar(10) NOT NULL DEFAULT '',
  `same_address` char(1) DEFAULT 'Y',
  `order_total` double(8,2) DEFAULT NULL,
  `user_id` int(10) DEFAULT NULL,
  `email` varchar(80) DEFAULT NULL,
  PRIMARY KEY (`id`)
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.

SELECT store_id
      , store_name
      , YEAR(mysql_order_date) AS OrderYear
      , SUM(order_total) AS TotalOrderAmount
FROM   orders
GROUP BY store_id
    , store_name
    , YEAR(mysql_order_date) 
ORDER BY store_id
        , store_name
        , orderYear

Open in new window

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.