I wrote 2 gueries, both of them return set of integer values how can I Subtract them?
first query:
SELECT Goods.Title, SUM([Transaction].Price) FROM [Transaction] INNER JOIN Market ON [Transaction].Market_Id=Market.Id INNER JOIN MarketType ON Market.MarketType_Id=MarketType.Id INNER JOIN Goods ON [Transaction].Goods_Id=Goods.Id WHERE (MarketType_Id=1) GROUP BY Goods.Title
SELECT Goods.Title, SUM([Transaction].Price) FROM [Transaction] INNER JOIN Market ON [Transaction].Market_Id=Market.Id INNER JOIN MarketType ON Market.MarketType_Id=MarketType.Id INNER JOIN Goods ON [Transaction].Goods_Id=Goods.Id WHERE (MarketType_Id=2) GROUP BY Goods.Title
in fact I want to do this but this error happens: Incorrect syntax near '-'.
(SELECT Goods.Title, SUM([Transaction].Price) FROM [Transaction] INNER JOIN Market ON [Transaction].Market_Id=Market.Id INNER JOIN MarketType ON Market.MarketType_Id=MarketType.Id INNER JOIN Goods ON [Transaction].Goods_Id=Goods.Id WHERE (MarketType_Id=1) GROUP BY Goods.Title) - (SELECT Goods.Title, SUM([Transaction].Price) FROM [Transaction] INNER JOIN Market ON [Transaction].Market_Id=Market.Id INNER JOIN MarketType ON Market.MarketType_Id=MarketType.Id INNER JOIN Goods ON [Transaction].Goods_Id=Goods.Id WHERE (MarketType_Id=2) GROUP BY Goods.Title)
pleas help me!

New Topic/Question
Reply



MultiQuote





|