Hello,

I must be missing something obvious here...

I have created my database like this:

CREATE TABLE Folders (folderid INTEGER PRIMARY KEY, parentid INTEGER,
rootid INTEGER, path VARCHAR(255))";

The database is filled with files and folders..

folderid parentid rootid path
1       0       1       C:\MP3\Albums\
2       1       1       C:\MP3\Albums\Abba - Definitive Collection\
3       2       1       C:\MP3\Albums\Abba - Definitive Collection\cd1\
4       2       1       C:\MP3\Albums\Abba - Definitive Collection\cd2\

Then I want to delete 'C:\MP3\Albums' folder and its sub-folders:

I figured this should work:
DELETE FROM Folder WHERE folderid IN (SELECT folderid FROM Folder
WHERE path LIKE :PATH || '%');

Where :PATH is 'C:\MP3\Albums\'

If I run the sub-query by itself it returns the resultset from above
but when I run it like above, sqlite3_changes(..) returns '1' and only
the row with folderid=1 is deleted.

What am I doing wrong?
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to