Need help in deleting Records

Discussion in 'C' started by sphamasango, Aug 8, 2012.

  1. sphamasango

    sphamasango New Member

    Joined:
    Aug 8, 2012
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi.
    Can any one help with a solution.
    I have three tables in a database:"tableCustomer","tableOrders","tableOrderPrints".now I need to delete all related records in table “order” before deleting the customer. Given that the table “OrderPrints” is also related to the table “Order”, I must delete all related records first! Please help
     
  2. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    How can we help without more detail? You're correct - to maintain database integrity you must delete all related records first. How to determine what records are related is the question here. You can use SELECT...WHERE to experiment, and when you get the result you like you can do DELETE...WHERE using the same WHERE clause.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice