hi
i'm trying to delete records from multible tables
i have 5 tables
ITEM,CATEGORY,PICTURE,VIDEO,AUDIO
every item has a picture and vedio & audio
and the item has a category
in my app i take the category name and delete it with all its items & vedios &pictures & audios
(note : there is no relation between the CATEGORY & PICTURE,VIDEO,AUDIO but i have a relation between the ITEM & CATEGORY using the CATEGORYId)
itry the following:
DELETE ITEM.*,CATEGORY.*,PICTURE.*,VIDEO.*,AUDIO.* FROM ITEM,CATEGORY,PICTURE,VIDEO,AUDIO WHERE ITEM.CategoryId=CATEGORY.CategoryId AND ITEM.PictureId=PICTURE.PictureId AND ITEM.VideoId=VIDEO.VideoId AND ITEM.AudioId=AUDIO.AudioId AND CategoryName ='" + textBox1.Text.ToString() + "' ;";
the msg the i get : 0 categoryes deleted !
some one advise me to use inner join
so i try :
"DELETE CATEGORY.*,ITEM.*,PICTURE.*,VIDEO.*,AUDIO.*
FROM CATEGORY INNER JOIN (PICTURE INNER JOIN (VIDEO INNER JOIN (AUDIO INNER JOIN ITEM ON ITEM.AudioId=AUDIO.AudioId )
ON ITEM.VideoId=VIDEO.VideoId ) ON ITEM.PictureId=PICTURE.PictureId) ON CATEGORY.CategoryId=ITEM.CategoryId
WHERE CategoryName ='" + textBox1.Text.ToString() + "' ;";
but it does not work
can you advice me plz?
thanks in advance
i'm trying to delete records from multible tables
i have 5 tables
ITEM,CATEGORY,PICTURE,VIDEO,AUDIO
every item has a picture and vedio & audio
and the item has a category
in my app i take the category name and delete it with all its items & vedios &pictures & audios
(note : there is no relation between the CATEGORY & PICTURE,VIDEO,AUDIO but i have a relation between the ITEM & CATEGORY using the CATEGORYId)
itry the following:
DELETE ITEM.*,CATEGORY.*,PICTURE.*,VIDEO.*,AUDIO.* FROM ITEM,CATEGORY,PICTURE,VIDEO,AUDIO WHERE ITEM.CategoryId=CATEGORY.CategoryId AND ITEM.PictureId=PICTURE.PictureId AND ITEM.VideoId=VIDEO.VideoId AND ITEM.AudioId=AUDIO.AudioId AND CategoryName ='" + textBox1.Text.ToString() + "' ;";
the msg the i get : 0 categoryes deleted !
some one advise me to use inner join
so i try :
"DELETE CATEGORY.*,ITEM.*,PICTURE.*,VIDEO.*,AUDIO.*
FROM CATEGORY INNER JOIN (PICTURE INNER JOIN (VIDEO INNER JOIN (AUDIO INNER JOIN ITEM ON ITEM.AudioId=AUDIO.AudioId )
ON ITEM.VideoId=VIDEO.VideoId ) ON ITEM.PictureId=PICTURE.PictureId) ON CATEGORY.CategoryId=ITEM.CategoryId
WHERE CategoryName ='" + textBox1.Text.ToString() + "' ;";
but it does not work
can you advice me plz?
thanks in advance