Title: Updating a folder tree across three tables based on parent-child relationships
Questionear friends.
I plead with you. Please help is you can.
I have three tables Folders, Files, and Comments.
For every folder there are zero or many child folders and zero or many files which have has zero or many comments.
An example of a set of folders
FOlder Name Folder_Id FOlder_Parent
folder_1 87 0
folder_1_sub 89 87
folder_1_sub_sub 93 89
folder_1_sub_sub_sub 98 93
The SQL I need to make is an update statement.
UPDATE COMMENTS
SET Is_Deleted='1'
WHERE File_Id='Select File_ Id From FILES where FOlder_ID = @Foloder_Id';
UPDATE FILES
SET Is_Deleted='1'
WHERE Folder_Id='@Folder_Id';
UPDATE FOLDERS
SET Is_Deleted='1'
WHERE Folder_Id='@Folder_Id';
and somehow i need to do this for each child folder also!
Ugh!
Questionear friends.
I plead with you. Please help is you can.
I have three tables Folders, Files, and Comments.
For every folder there are zero or many child folders and zero or many files which have has zero or many comments.
An example of a set of folders
FOlder Name Folder_Id FOlder_Parent
folder_1 87 0
folder_1_sub 89 87
folder_1_sub_sub 93 89
folder_1_sub_sub_sub 98 93
The SQL I need to make is an update statement.
UPDATE COMMENTS
SET Is_Deleted='1'
WHERE File_Id='Select File_ Id From FILES where FOlder_ID = @Foloder_Id';
UPDATE FILES
SET Is_Deleted='1'
WHERE Folder_Id='@Folder_Id';
UPDATE FOLDERS
SET Is_Deleted='1'
WHERE Folder_Id='@Folder_Id';
and somehow i need to do this for each child folder also!
Ugh!