mysql - displaying revenue for each year -
i'm using northwind sql database. not familiar, has of following tables:
 orders,   orderdetails,   products,    categories   (orders.orderid = orderdetails.orderid)   (products.productid = orderdetails.productid)  (categories.categoryid = products.categoryid)   orders has column named "orderdate" (formatted dd/mm/yy)  orderdetails has column named "price"   i need display total "revenue" each year. is, sum of "prices". idea how so?
try this, don't have complete table structure. way of group mysql
   select sum (od.price) revenue orderdetails od     inner join orders o on orders.orderid = orderdetails.orderid     group year(o.orderdate);      
Comments
Post a Comment