I am sure this is easy but I can't get my head round it.
I have 2 tables in a 1 to many relationship.
Table 1 (one) contains
itemid
qtyordered
Table 2 (many) contains
itemid
qtyreceived
What I want is
itemid
qtyordered
sum(qtyreceived)
but only where qtyordered > qtyreceived
The problem seems to be how to reference the summed field in the where clause.
I have 2 tables in a 1 to many relationship.
Table 1 (one) contains
itemid
qtyordered
Table 2 (many) contains
itemid
qtyreceived
What I want is
itemid
qtyordered
sum(qtyreceived)
but only where qtyordered > qtyreceived
The problem seems to be how to reference the summed field in the where clause.