I have a "sizes" and a "finishes" table each of which has an "available" boolean field.
A "products" table uses the "sizes" id and "finishes" id, which are primary key fields, to build products.
I would like to maintain an "available" boolean field in the "products" table as well.
Would FOREIGN KEYs be able to update the "products"."available" field as in:
Code:
UPDATE
products
INNER JOIN
sizes
ON
sizes.sizeId = products.sizeId
INNER JOIN
finishes
ON
finishes.finishId = products.finishId
SET
products.available = ( sizes.available AND finishes.available )
and if yes, how to set the FKs up?
Thanks for any help,
David