Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

delete products


dvcompt

Recommended Posts

Just out of curiosity, matti, what nine are you counting?

 

I don't count that many, but you would probably know better than I.

 

If you give me the nine tables, I'll write the query that will delete al of the products that have a price of 0.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

I just counted all that had 'products' in the name :blush: but I think only these:

 

products

products_attributes

products_attributes_download

products_description

products_notifications

products_to_categories

 

Matti

Link to comment
Share on other sites

This should work.

 

Please backup first. I didn't run it first, but I think it's ok.

 

delete pc.*
from products_to_categories  pc, products p
where p.products_id = pc.products_id and p.products_price = 0

delete pn.*
from products_notifications pn, products p
where p.products_id = pn.products_id and p.products_price = 0

delete pd.*
from products_description pd, products p
where p.products_id = pd.products_id and p.products_price = 0

delete pad.*
from products_attributes_download pad, products_attributes pa, products p
where pad.products_attributes_id = pa.products_attributes_id and p.products_id = pa.products_id and p.products_price = 0

delete pa.*
from products_attributes pa, products p
where p.products_id = pa.products_id and p.products_price = 0

delete p.*
from products p
where p.products_price = 0

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

this is my file delete.php - don?t work

delete pc.*

from products_to_categories ?pc, products p

where p.products_id = pc.products_id and p.products_price = 0

delete pn.*

from products_notifications pn, products p

where p.products_id = pn.products_id and p.products_price = 0

delete pd.*

from products_description pd, products p

where p.products_id = pd.products_id and p.products_price = 0

delete pad.*

from products_attributes_download pad, products_attributes pa, products p

where pad.products_attributes_id = pa.products_attributes_id and p.products_id = pa.products_id and p.products_price = 0

delete pa.*

from products_attributes pa, products p

where p.products_id = pa.products_id and p.products_price = 0

delete p.*

from products p

where p.products_price = 0

The result is only screen where is write this code.

this:

delete pc.* from products_to_categories pc, products p where p.products_id = pc.products_id and p.products_price = 0 delete pn.* from products_notifications pn, products p where p.products_id = pn.products_id and p.products_price = 0 delete pd.* from products_description pd, products p where p.products_id = pd.products_id and p.products_price = 0 delete pad.* from products_attributes_download pad, products_attributes pa, products p where pad.products_attributes_id = pa.products_attributes_id and p.products_id = pa.products_id and p.products_price = 0 delete pa.* from products_attributes pa, products p where p.products_id = pa.products_id and p.products_price = 0 delete p.* from products p where p.products_price = 0

 

donť delete products from database.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...