我想得到一个完整的产品销售在一年内,按产品名称或SKU分组。
我试过使用Admin > Products > ProductsOrdered并选择了时间框架。然而,这提供了错误的数据,也许是因为我们已经捆绑了产品,我们销售了很多捆绑产品。
对于SQL如何做到这一点,有什么想法吗?
编辑:
这是当前的输出,没有错误的格式,但提供的数据是错误的。
---------------------------------------------------------------------------------
|Period | Product Name | Quantity Ordered |
|-------|----------------------------------------------------|------------------|
|2015 | std charge charge (Per Sofa) | 96 |
|2015 | New Jersey 3 + 1 + 1 Seater Black Leather Sofa Set | 68 |
|2015 | New Jersey 3 + 1 + 1 Seater Black Leather Sofa Set | 60 [ Repeated?] |
|2015 | Rex Black 3 + 2 GM200E | 52 |
..........发布于 2016-02-17 11:01:58
select * from yourtable group by year,product_name;或
select * from yourtable where date_column between 01-01-2016 and 31-12-2016 group by product_name发布于 2016-02-17 11:56:28
SELECT(product name) FROM(table name) WHERE (PERIOD=2015);https://stackoverflow.com/questions/35453966
复制相似问题