I want to do this:
delete from table1 a,table2 b, table3 c
where a.col1 = b.col1
and b.col2 = c.col2
and a.co3 <> 8001;
But its giving me an error.
I want to do this:
delete from table1 a,table2 b, table3 c
where a.col1 = b.col1
and b.col2 = c.col2
and a.co3 <> 8001;
But its giving me an error.
delete the lowest level first and move up from there, one delete per level, to the highest level:
DELETE FROM ChildTable WHERE ParentID=...
DELECT FROM ParentTable WHERE ParentID=...
Since you did not specify to what each table has a foreign key and on which field, I'll take a guess:
Delete TableC
Where Exists( Select 1 From TableA Where TableA.Col1 = TableC.Col2 And TableA.Col3 <> '8001' )
Delete TableB
Where Exists( Select 1 From TableA Where TableA.Col1 = TableB.Col2 And TableA.Col3 <> '8001' )
Delete TableA
Where Col3 <> '8001'
delete A from table1 a,table2 b, table3 c
where a.col1 = b.col1
and b.col2 = c.col2
and a.co3 <> 8001;