Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need to do some delete in several tables

Status
Not open for further replies.

alec

Programmer
Mar 7, 2001
21
US
I have 4 tables, each has the exact same PK and FK
If I do join to all of these tables I will get one huge table.

Now that I need to delete some records (from my CF application), for example from table 1, consequently I also need to delete from 3 others table otherwise I wil create some ghost records.
Unfortunately I wasn't able to do this, I need syntax help.

I wrote the following and got an error:
My script:
Delete
from table1,table2,table3,table4
Where table1.Id = table2.Id
AND table1.Id = table3.Id
AND table1.Id = table4.Id
AND status = 'D'

error:
Server Message: Number 102, Severity 15
Server 'VCB', Line 2:
Incorrect syntax near ','.

I'm using Sybase and Coldfusion 8

 
You can try:

Delete table1,table2,table3,table4
FROM table1,table2,table3,table4
Where table1.Id = table2.Id
AND table1.Id = table3.Id
AND table1.Id = table4.Id
AND status = 'D'

-Tek
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top