Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
Fribble
Starting Member
3 Posts |
Posted - 2007-10-17 : 17:22:00
|
HiI have a small problem I have run into with my coursework for ICT. I have a database for a garage, with a Customer Table and a Car Table in it. I wish to have a delete query, that will remove the customer from the table, and remove all the cars that are under his ID number. So far I have;DELETE tblCustomer.*FROM tblCustomerWHERE (tblCustomer.[Customer ID])=[Enter Customer ID]; andDELETE tblCar.*FROM tblCarWHERE (((tblCar.Owner)=[Enter Customer ID])); (Customer ID in car table is named Owner)So i need to lookup a customer with ID X then delete it, then find all the cars with owner of X, then delete all those too.Is there anyway to do this in one statment, where it will not ask for a "Enter Customer ID" input twice.Many thanks in advance |
|
Van
Constraint Violating Yak Guru
462 Posts |
Posted - 2007-10-17 : 17:49:31
|
Hey, see if my response at the bottom of this thread helps...http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=91164 |
 |
|
|
|
|