scumdk Posted December 19, 2011 Share Posted December 19, 2011 Hej folkens. Jeg har en webshop hvor jeg har 500+ varer der er inaktive, som jeg meget gerne vil have slettet helt fra shoppen. Dette tager dog 100 år en af gangen og derfor søger jeg forslag til hvordan jeg kan slette dem nemt. Min umiddelbare løsning er at køre en SQL kommando fra PHPMyAdmin som ser sådan her ud: DELETE FROM ps_product WHERE id_product=1 DELETE FROM ps_product WHERE id_product=2 DELETE FROM ps_product WHERE id_product=3 DELETE FROM ps_product WHERE id_product=4 ..osv osv osv Men det fjerner kun produkterne fra denne tabel og tager jeg fejl hvis jeg siger at de vist ligger i andre tabeller også? Hvilke er det jeg yderligere skal fjerne dem fra så de er HELT væk? Håber i kan hjælpe og måske findes der et modul der kan dette som jeg ikke kender til? :-) På forhånd tak for hjælpen og for et super godt dansk forum! Link to comment Share on other sites More sharing options...
Guest Posted December 19, 2011 Share Posted December 19, 2011 DELETE FROM ps_product WHERE active = 0 UDEN ANSVAR. TAG KOPI AF TABELLEN FØRST. PRODUKTET KAN OGSÅ LIGGE I UNDERLIGGENDE TABELLER: PS_PRODUCT_%, MEN DET ER UNDERORDNET, FOR NÅR PRODUKTET ER SLETTET FRA PS_PRODUCT, SÅ TABER DU ALLE NØGLERNE TIL DE UNDERLIGGENDE TABELLER. MEN HVORFOR SLETTE. HVAD SIGER REVISOREN? UMIDDELBART SKAL MAN HVERKEN SLETTE PRODUKTER, ORDRER, KUNDER OG HVAD VED JEG. HAR DU OPRYDNINGS PARANOIA? Link to comment Share on other sites More sharing options...
scumdk Posted December 19, 2011 Author Share Posted December 19, 2011 Ahh... se den havde jeg ikke lige tænkt på, tak for det :-) Shoppen er slet ikke live endnu, så revisoren har intet at sige ;-) Jeg kommer til at have 25.000 varenumre i shoppen og da der vil være stort udskiftning i varene, ville min produktdatabase blive MEGA hvis jeg ikke ryddede op i ny og næ :-) Vender lige tilbage når det er afprøvet..... Link to comment Share on other sites More sharing options...
presta-dyr Posted December 20, 2011 Share Posted December 20, 2011 (edited) Hvis du vil fjerne diverse referencer, til de varer du har slettet, kan du køre disse kommandoer: DELETE FROM `ps_attribute_impact` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_category_product` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_image` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_image_lang` WHERE `id_image` NOT IN (SELECT `id_image` FROM `ps_image`); DELETE FROM `ps_product_lang` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_product_attribute` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_product_attribute_combination` WHERE `id_product_attribute` NOT IN (SELECT `id_product_attribute` FROM `ps_product_attribute`); DELETE FROM `ps_product_attribute_image` WHERE `id_product_attribute` NOT IN (SELECT `id_product_attribute` FROM `ps_product_attribute`); DELETE FROM `ps_feature_product` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_feature` WHERE `id_feature` NOT IN (SELECT `id_feature` FROM `ps_feature_product`); DELETE FROM `ps_feature_lang` WHERE `id_feature` NOT IN (SELECT `id_feature` FROM `ps_feature`); DELETE FROM `ps_feature_value` WHERE `id_feature` NOT IN (SELECT `id_feature` FROM `ps_feature`); DELETE FROM `ps_feature_value_lang` WHERE `id_feature_value` NOT IN (SELECT `id_feature_value` FROM `ps_feature_value`); DELETE FROM `ps_manufacturer` WHERE `id_manufacturer` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_manufacturer_lang` WHERE `id_manufacturer` NOT IN (SELECT `id_manufacturer` FROM `ps_manufacturer`); DELETE FROM `ps_accessory` WHERE `id_product_1` NOT IN (SELECT `id_product` FROM `ps_product`); DELETE FROM `ps_specific_price` WHERE `id_product` NOT IN (SELECT `id_product` FROM `ps_product`); /Kjeld Edited December 21, 2011 by presta-dyr Ups, der skulle lige rettes en linie. (see edit history) Link to comment Share on other sites More sharing options...
scumdk Posted December 21, 2011 Author Share Posted December 21, 2011 Det virkede faktisk rigtig fint med denne kommando fra SQL under PHPMyAdmin og det gik stærkt: DELETE FROM ps_product WHERE id_product=1 DELETE FROM ps_product WHERE id_product=2 DELETE FROM ps_product WHERE id_product=3 DELETE FROM ps_product WHERE id_product=4 ..osv osv osv Kjeld > Det ser godt nok advanceret ud det der... Fjerner det bare de rester der måtte være efter de 500+ produkter jeg nu har slettet fra ps_product? Tusind tak for jeres input :-) Link to comment Share on other sites More sharing options...
presta-dyr Posted December 21, 2011 Share Posted December 21, 2011 Ja. Plus ubrugte features og manufacturers. /Kjeld 1 Link to comment Share on other sites More sharing options...
scumdk Posted December 21, 2011 Author Share Posted December 21, 2011 Ja. Plus ubrugte features og manufacturers. /Kjeld Det er verdensklasse Kjeld. Tusind tak :-) Fik dog lige den her fejl: Fejl SQL-forespørgsel: DELETE FROM `ps_feature` WHERE `id_feature` NOT IN ( SELECT `id_feature_product` FROM `ps_feature_product` ); MySQL returnerede: #1054 - Unknown column 'id_feature_product' in 'field list' Link to comment Share on other sites More sharing options...
presta-dyr Posted December 21, 2011 Share Posted December 21, 2011 Damned, der var lige en fejl. Jeg har rettet det i mit indlæg ovenfor. /Kjeld Link to comment Share on other sites More sharing options...
scumdk Posted December 22, 2011 Author Share Posted December 22, 2011 Damned, der var lige en fejl. Jeg har rettet det i mit indlæg ovenfor. /Kjeld Så virkede det lige som det skulle. Endnu engang tusind tak Kjeld :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now