47.Merchant - 生成上月销售报告
索尼娅,dimestore总经理,要求她的销售人员上月销售报告。

鲁迪运行N1QL查询生成报告所需的数据。试一下。
SELECT SUBSTR(purchases.purchasedAt, 0, 7) as month,
ROUND(SUM(product.unitPrice * items.count)/1000000, 3) revenueMillion
FROM purchases UNNEST purchases.lineItems AS items JOIN product ON KEYS items.product
GROUP BY SUBSTR(purchases.purchasedAt, 0, 7)
ORDER BY month结果:
Last updated
Was this helpful?