I am having a problem with a SQL Where Clause. There are 3 tables involved (Inventory, Invbalance, and invreserve). The inventory table contains a numeric value in one of its columns (curbal). I want the where clause to return records from the inventory table if the value in the curbal column is greater than or equal to the sum of a column in the invbalance table minus the sum of a column in the invreserve table. Following is the SQL that I've used:
where minlevel >=
A problem occurs if the invreserve table doesn't have any row in it. If that's the case, I'd like the sum for that table to be 0 and the comparison would just be to the sum in the invbalance table. It appears, instead, that the arithmetic just doesn't work. If there are no rows in the invreserve table, the where clause returns nothing.
I guess the question is, how can I set the sum for the invreserve table to 0 if there are no rows?