I have 2 tables, say tblA and tblB.
tblA has columns Account, Symbol, SellBuy,Quantity.
tblB has columns Account, Symbol, BuyQuantity, SellQuantity.
If tblB has the same account/symbol with the opposite type (ie, if tblA is a Buy, tblB is a Sell, if tblA is a Sell, tblB is a Buy), then I need the query to return nothing.
How can I do that ?
Thank you.
For ex:
- If these are the data
tblA
Acc1,SymA,Sell,1
tblB
Acc1,SymA,1,0
The query needs to return nothing.
- If these are the data
tblA
Acc1,SymA,Sell,1
tblB
Acc1,SymA,0,1
The query needs to return
Acc1,SymA,1 as Sell
- If these are the data
tblA
Acc1,SymA,Sell,1
Acc1,SymB,Buy,1
tblB
Acc1,SymA,0,1
The query needs to return
Acc1,SymA,1 as Sell
Acc1,SymB,1 as Buy