At 18:07, 19990829, James Manning wrote:
>> When you are deleting, you must issue two deletes. For example:
>> DELETE FROM order_table WHERE customer_id = $saved_customer_id
>> DELETE FROM customer_table WHERE customer_id = $saved_customer_id
>Might need to make that first one:
> WHERE customer_id = $saved_customer_id AND order_id = $order_id
>(or else those repeat customers might lose some orders :)
Yes, I should have been explicit in what I was doing. I was removing
a customer (analogous to adding a customer), and thus removing all of
the orders that were assigned to the customer.
The idea is that, if you're deleting the customer then the orders are
bogus (the customer_id field points to a non-existent customer!). You
should either transfer those orders over to some other customer (perhaps
you have a special "defunct" customer) before deleting the customer if
you want to keep the orders around.