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 |
salmonraju
Yak Posting Veteran
54 Posts |
Posted - 2006-11-02 : 07:25:26
|
i created two tables Parent ,Child parent table ID Salary primary key is ID 1 2000 2 3000 3 4000 4 4000 5 4000 Child Table foreign key is id id Dept 1 20 2 15 3 20now i want a query to delete all rows in parent table IF NO RELATIONS EXISTSEx: delete from Parent Where id<6My desired output is 2 rows deleted (i.e, 4,5)but for this query error Message is generated.How to make work this query so that it may delete 4th and 5th rows |
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2006-11-02 : 07:28:17
|
delete pfrom parent pleft join child c on c.id = p.idwhere c.id is nullPeter LarssonHelsingborg, Sweden |
 |
|
|
|
|