- Moderator
- #1
I have 3 tables... "Products", "Categories", and "CategoryProduct"
Obviously, CategoryProduct has a one-to-many link between "Products" and "Categories".
I need to conditionally delete rows from CategoryProduct.
I guess just explaining what I need it to do is the easiest.
If a Product exists in CategoryProduct, and the CategoryID <> (whatever I need it to be), then delete the line.
IN other words:
I want to remove all lines in CategoryProduct where the ProductID for specific products exists in CategoryProduct, *UNLESS* the category = an arbitrary number.
So, if CategoryProduct looks like this:
ProductID CategoryID
1 10
1 11
1 12
.... and I want just "10" left in there, I need to delete the 2nd and 3rd lines.
Does that make sense?
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg
Obviously, CategoryProduct has a one-to-many link between "Products" and "Categories".
I need to conditionally delete rows from CategoryProduct.
I guess just explaining what I need it to do is the easiest.
If a Product exists in CategoryProduct, and the CategoryID <> (whatever I need it to be), then delete the line.
IN other words:
I want to remove all lines in CategoryProduct where the ProductID for specific products exists in CategoryProduct, *UNLESS* the category = an arbitrary number.
So, if CategoryProduct looks like this:
ProductID CategoryID
1 10
1 11
1 12
.... and I want just "10" left in there, I need to delete the 2nd and 3rd lines.
Does that make sense?
Just my 2¢
"What the captain doesn't realize is that we've secretly replaced his Dilithium Crystals with new Folger's Crystals."
--Greg