On 27-11-2014 10:48, [email protected] [firebird-support] wrote: > > > hi to all, > i have a problem i want join three tables, this is the structure > (semplified) > > Seller > IdSeller > NameSeller > > BuyFromSeller > IdBuy > Qty > Cost > FkSeller > > Sell > IdSell > QtySell > Price > FkSeller > > i want know all the buy and the sell for seller (if there are) > > i have tried > select > Seller.NameSeller, > sum(buyfromseller.qty*buyfromseller.cost) as buys, > sum(sell.qtysell*sell.price) as Sells, > from > Seller > left join buyfromseller on buyfromseller.fkseller=seller.idseller > left join sell on sell.fkseller=seller.idseller > group by > seller.nameseller > > but it turn me doubles values for the sell sum, how can i resolve it?
Just for reference: I answered this question on StackOverflow: http://stackoverflow.com/questions/27168284/join-three-tables-in-firebirdsql -- Mark Rotteveel
