Hi:
Is there any SQL SELECT command, to obtain from a table the SUM and REST from a field , depend of another field, for example
Table1 (PRODUCT, QUANTITY , TYPE)
PRODUCT-A , 3 , P
PRODUCT-A , 2 , P
PRODUCT-A , 1 , N
PRODUCT-B , 3 , P
PRODUCT-B , 4 , P
WHERE TYPE=P (POSITIVE)
TYPE=N (NEGATIVE)
and group by PRODUCT
and obtain the RESULT as (PRODUCT , TOTAL-QUANTITY)
PRODUCT-A , 4
PRODUCT-B. , 7
it means PRODUCT-A. (3+2-1 = 4)
PRODUCT-B. (3+4 = 7)
THANKS IN ADVANCED
MANUEL
Is there any SQL SELECT command, to obtain from a table the SUM and REST from a field , depend of another field, for example
Table1 (PRODUCT, QUANTITY , TYPE)
PRODUCT-A , 3 , P
PRODUCT-A , 2 , P
PRODUCT-A , 1 , N
PRODUCT-B , 3 , P
PRODUCT-B , 4 , P
WHERE TYPE=P (POSITIVE)
TYPE=N (NEGATIVE)
and group by PRODUCT
and obtain the RESULT as (PRODUCT , TOTAL-QUANTITY)
PRODUCT-A , 4
PRODUCT-B. , 7
it means PRODUCT-A. (3+2-1 = 4)
PRODUCT-B. (3+4 = 7)
THANKS IN ADVANCED
MANUEL