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 |
webfort
Starting Member
9 Posts |
Posted - 2006-06-30 : 05:14:31
|
HiI was wondering if someone could help me, I'm trying to clean up some records on my database, I have managed to clean up a table of duplucate records, how ever this was in a relation to another table, is there anyway of clearing up the second table ieIf this number does not exist in this column then delete the record.Would really appreciate it if any one could help, these are the two tables[Customers] [orders]Customerid Orderidfirstname CustomeridThanksAshley |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-08-18 : 06:40:16
|
To find out which customers that not have an orderSELECT Customers.*FROM CustomersLEFT JOIN Orders ON Orders.CustomerID = Customers.CustomerIDWHERE Orders.OrderID IS NULL Peter LarssonHelsingborg, Sweden |
 |
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2006-08-18 : 11:42:41
|
orSELECT *FROM Customers CWhere not exists (Select * from Orders where CustomerID = C.CustomerID) MadhivananFailing to plan is Planning to fail |
 |
|
|
|
|