List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:August 29 1999 10:11pm
Subject:Re: Adding & delete across 2 tables
View as plain text  
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.

Adding & delete across 2 tablesma lata29 Aug
  • Re: Adding & delete across 2 tablesThimble Smith29 Aug
    • Re: Adding & delete across 2 tablesJames Manning30 Aug
      • Re: Adding & delete across 2 tablesThimble Smith30 Aug
  • Re: Adding & delete across 2 tablesMartin Ramsch30 Aug
  • Re: bdb table data deletedSinisa Milivojevic1 Feb