|
|

楼主 |
发表于 2006/9/14 19:08:43
|
显示全部楼层
- select ORGANIZATION_ID,
- INVENTORY_ITEM_ID,
- to_char(TRANSACTION_DATE, 'YYYY') YY,
- to_char(TRANSACTION_DATE, 'MM') MM,
- sum(decode(sign(TRANSACTION_QUANTITY), +1, TRANSACTION_QUANTITY)) sum_in,
- sum(decode(sign(TRANSACTION_QUANTITY), -1, TRANSACTION_QUANTITY)) sum_out
- from mtl_material_transactions
- group by ORGANIZATION_ID,
- to_char(TRANSACTION_DATE, 'YYYY'),
- to_char(TRANSACTION_DATE, 'MM'),
- INVENTORY_ITEM_ID
复制代码
这个是最基础的sql
希望可以有个比较好的方法 |
|