2016-05-31 7 views

答えて

0

構造は、アプリケーションの動作に基づいて異なる場合があります。絶対的な方法はありません。しかし、私はあなたの例を与えると、あなたのアイデアを見つけることができます。

在庫表:

id 
date 
merchandise_id 
amount (negative for exit and positive for entry) 
inventory_id (this is null for entry and includes the id of entry for exits) 

サンプルデータ:

id |  date  | merchandise_id | amount | inventory_id 
----------------------------------------------------------------- 
1 | 2016-06-01 |  32  | 100 |  NULL 
2 | 2016-06-03 |  32  | -20 |  1 
3 | 2016-06-04 |  32  | -30 |  1 
関連する問題