Re: [GENERAL] Query to "balance" rows across multiple tables

2010-07-02 Thread Tim Landscheidt
Mike Christensen wrote: > [...] > Here's the catch: I want to DELETE any row (in either table) that has > zero quantity, since I no longer need this data (plus I have a CHECK > constraint on this value and require it to be positive anyway).. > Is there actually a way to do this in a SQL function

[GENERAL] Query to "balance" rows across multiple tables

2010-07-02 Thread Mike Christensen
I have two tables. One for the quantity of an item I need to buy, and one for the quantity of an item I already own. I want to "balance" these two tables so that I subtract the amount I need from what I own.. For example: ToBuy - Item A: 6 Item B: 5 Item C: 3 Owned - Item A: 1