| SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it. |
|
|||
Stock holdingsHello,
I am trying to create a stock holding database in MS Access. There are two tables called Buy and Sell. Both tables will contain multiple buy and sell records. I would need to write a query that should give me the current holdings (sum of all buy records minus sum of all sell records grouped by stock name. If there is no stock in the sell table, then only the buy holdings needs to be shown). Please help me out in writing a SQL for this. Thank you in advance. |
|
|||
|
hi, try this
SELECT B.StockName, B.Total-ISNULL(S.Total,0) AS Total |