Click here to Skip to main content
15,891,757 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have been trying to execute this sql syntax. its to delete from multiple tables but i cant seem to get it right. i checked to make sure it conforms with the one in the mysql manual but it still wont work. the debugger tells me there is a unnecessary comma(,) somewhere. any help. the 'id' field is already set in the code


sql = "delete from apps, contacts, firstdeg, hnd, interview, other, secdeg, thirddeg using apps join contacts on apps.FileLoc = contacts.FileLoc join firstdeg on apps.FileLoc = firstdeg.FileLoc join hnd on apps.FileLoc = hnd.FileLoc join interview on apps.FileLoc = interview.FileLoc join other on apps.FileLoc = other.FileLoc join secdeg on apps.FileLoc = secdeg.FileLoc join thirddeg on apps.FileLoc = thirddeg.FileLoc where apps.FileLoc = '"+id+"'";
Posted

You don't have delete from multiple table. Use cascade while deleting. Another records from other tables will be automatically deleted if there is a relation. To know about cascade google it. If there is no relation btwn tables just make separate statements.
 
Share this answer
 
v2
The general syntax is:

DELETE FROM tablename WHERE condition
 
Share this answer
 
Comments
[no name] 13-Jan-11 5:39am    
yes, but i want to delete from multiple tables and its giving me problems
Thomas Krojer 13-Jan-11 11:02am    
ok, I checked the manual now. check your statement between using and join ... in my manual it looks a bit different.
[no name] 13-Jan-11 11:35am    
thanks i think the cascade method is simpler

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900