T
Team
Hello,
I have a table in my database called OpenTrades. In this table, there
are 2 fields I am concerned with, Shares and TransCode.
I want to have a query add or subtract all the open trades for a
particular CUSIP (Found in the OpenTrades Query column CUSIP) that is
in a certain Account (in table in column called AccNum). Currently, I
have code for a query to do this, however it only adds the trades. I
want to have it look to see what to do, as follows:
If TransCode is B, I want it to subtract, and if TransCode is SEL, I
want it to add.
Here is what I have so far.
SELECT AccNum, CUSIP, Sum([Shares]) AS OTShares
FROM [Open Trades]
GROUP BY AccNum, CUSIP;
Does anyone know how to modify this script to get the process to work
correctly?
Thanks.
I have a table in my database called OpenTrades. In this table, there
are 2 fields I am concerned with, Shares and TransCode.
I want to have a query add or subtract all the open trades for a
particular CUSIP (Found in the OpenTrades Query column CUSIP) that is
in a certain Account (in table in column called AccNum). Currently, I
have code for a query to do this, however it only adds the trades. I
want to have it look to see what to do, as follows:
If TransCode is B, I want it to subtract, and if TransCode is SEL, I
want it to add.
Here is what I have so far.
SELECT AccNum, CUSIP, Sum([Shares]) AS OTShares
FROM [Open Trades]
GROUP BY AccNum, CUSIP;
Does anyone know how to modify this script to get the process to work
correctly?
Thanks.