Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Q: Updating a folder tree across three tables based on parent-child relationships

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2000-10-31 : 10:04:43
Patrick writes "Dear esteemed Gurus.
I plead with you. Please help.

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!"
   

- Advertisement -