File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes delete sql not working Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Databases » JDBC
Reply Bookmark "delete sql not working " Watch "delete sql not working " New topic
Author

delete sql not working

bhavin ragha
Greenhorn

Joined: Mar 28, 2012
Posts: 17
trying to delete all information relating to cd005

im putting in the statement below. But i get the error: near ",": syntax error... (im using sqlite)

delete from cds, bands, band_members, releases
where band_members.band_id = bands.band_id
and band_members.band_id = releases.band_id
and cds.cd_id = releases.cd_id
and cds.cd_id = 'cd005'

when i change delete to select * i get the values that i want to delete.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16483
    
    2

You can only delete rows from one table using the SQL DELETE statement.
bhavin ragha
Greenhorn

Joined: Mar 28, 2012
Posts: 17
Paul Clapham wrote:You can only delete rows from one table using the SQL DELETE statement.


so how do i delete all data relating to cd005
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56179
    
  13

One table at a time.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Saurabh Pillai
Ranch Hand

Joined: Sep 12, 2008
Posts: 449
Or if you are allowed to set cascade delete option.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: delete sql not working
 
Similar Threads
Why Just run in my PC ?
gui question
Head First Servlets: Beer Problem
Syntax error on Tokens delete these tokens???
package java.nio.file does not exist