troubleshooting Question

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

Avatar of sabecs
sabecs asked on
MySQL ServerDatabases
1 Comment1 Solution64 ViewsLast Modified:
Hi,
I need a query that will give add all "order_total" based on store id for each year?

Thanks in advance for your comments.

CREATE TABLE IF NOT EXISTS `orders` (
  `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`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=40 ;
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros