ここで質問したいのですが...説明させてください...ここには3つのテーブルがあります.1.トランザクションテーブル2.トランザクション詳細3.アイテム
いや、ここでの問題は、例として今月 (2013-01) のアイテムの売上を知りたいということです。これが私のテーブル構造です...
1 取引表
--------------------------
idTransaction | date | idUser | idCustomer | total | NOSC
--------------------------------------------------------------------
1 | 2013-01-01 | 3 | 4 | 500000 | 1CO
2 | 2013-01-01 | 3 | 5 | 450000 | 2CO
3 | 2013-01-01 | 3 | 6 | 250000 | 3CO
2 transaction_detail
-----------------------------------------------------------------
idTransaction | idItem | qty | price
----------------------------------------
1 | 1 | 2 | 250000
2 | 2 | 1 | 250000
2 | 3 | 1 | 200000
3 | 1 | 1 | 250000
3 アイテムテーブル
idItem | Name Item
---------------------------------------
1 | glass
2 | Medicine A
3 | Medicine B
4 顧客
idCustomer | Name Customer
--------------------------------------
4 | Abuh
5 | Abeh
6 | ABooh
したがって、これらのテーブルに基づいて、このようなデータを取得したいと思います....
Name Item | Nosc | Customer | Sold Quantity | @ Price | Total
---------------------------------------------
Glass | 1CO | Abuh |2 | 250000 | 500000
Glass | 3CO | ABooh |1 | 250000 | 250000
Medicine A| 2CO | Abeh |1 | 250000 | 250000
Medicine B| 2CO | Abeh |1 | 200000 | 200000
誰でも私を助けることができますか??