我该如何编写一个查询,该查询返回过去x个月中加利福尼亚州的汇总销售数据。加入两个表并获取汇总数据
----------------------- -----------------------
| order | | customer |
|-----------------------| |-----------------------|
| orderId int | | customerId int |
| customerId int | | state varchar |
| deposit decimal | -----------------------
| orderDate date |
-----------------------
-----------------------
| orderItem |
|-----------------------|
| orderId int |
| itemId int |
| qty int |
| lineTotal decimal |
| itemPrice decimal |
-----------------------
你尝试过什么?对于什么数据库?我很少看到使用格式设置的全新帐户帖子... – 2010-04-16 20:19:15
您希望聚合什么?总销售额,客户订单数量,总存款数量,销售的总数量? – TLiebe 2010-04-16 20:20:08
我喜欢格式! :) – Kiril 2010-04-16 22:54:09