我該如何編寫一個查詢,該查詢返回過去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