SELECT *, ceil(SUBSTR(name,LOCATE('szer.',name)+5,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) SELECT *, ceil(SUBSTR(name,LOCATE('wys.',name)+5,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) SELECT name, ceil(SUBSTR(name,LOCATE('komory',name)+6,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) SELECT name, ceil(SUBSTR(name,LOCATE('dł.',name)+4,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) SELECT *,ceil(name) FROM `ps_product_attribute1` LEFT JOIN `ps_product_attribute_combination` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute LEFT JOIN `ps_attribute_lang` ON `ps_attribute_lang`.id_attribute = `ps_product_attribute_combination`.id_attribute LEFT JOIN `ps_attribute` ON `ps_attribute`.id_attribute = `ps_attribute_lang`.id_attribute where `ps_attribute`.id_attribute_group=8 ORDER BY `ps_product_attribute1`.`dlugosc` DESC update ps_product_attribute1 a set a.dlugosc = (SELECT ceil(name) FROM `ps_product_attribute1` aa LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute LEFT JOIN `ps_attribute_lang1` ON `ps_attribute_lang1`.id_attribute = `ps_product_attribute_combination2`.id_attribute LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute where `ps_attribute1`.id_attribute_group=8 and aa.id_product=a.id_product) update ps_product_attribute1 set ps_product_attribute1.dlugosc =( SELECT ceil(name) FROM `ps_product_attribute1` LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute LEFT JOIN `ps_attribute_lang1` ON `ps_attribute_lang1`.id_attribute = `ps_product_attribute_combination2`.id_attribute LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute where `ps_attribute1`.id_attribute_group=8 and ps_product_attribute1.id_attribute ) SELECT *,ceil(name) FROM `ps_product_attribute1` LEFT JOIN `ps_product_attribute_combination` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute LEFT JOIN `ps_attribute_lang` ON `ps_attribute_lang`.id_attribute = `ps_product_attribute_combination`.id_attribute LEFT JOIN `ps_attribute` ON `ps_attribute`.id_attribute = `ps_attribute_lang`.id_attribute where `ps_attribute`.id_attribute_group=8 and ceil(name)>0 ORDER BY `ceil(name)` DESC SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product update ps_product_attribute1 a set a.dlugosc = (select dlugosc from ps_product_lang1 where id_product=a.id_product) update ps_product_attribute1 d set d.dlugosc = ( SELECT ceil(name) as dlugosc FROM `ps_product_attribute1` b LEFT JOIN `ps_product_attribute_combination` ON b.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute LEFT JOIN `ps_attribute_lang` ON `ps_attribute_lang`.id_attribute = `ps_product_attribute_combination`.id_attribute LEFT JOIN `ps_attribute` ON `ps_attribute`.id_attribute = `ps_attribute_lang`.id_attribute where `ps_attribute`.id_attribute_group=8 and d.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute ) SELECT ceil(name) from `ps_attribute_lang1` LEFT JOIN `ps_attribute` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute LEFT JOIN `ps_product_attribute1` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute where `ps_attribute1`.id_attribute_group=8 działa ! update ps_product_attribute1 d set d.wysokosc = ( SELECT ceil(name) from `ps_attribute_lang1` LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute where `ps_attribute1`.id_attribute_group=15 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute ) update ps_product_attribute1 d set d.dlugosc = ( SELECT ceil(name) from `ps_attribute_lang1` LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute where `ps_attribute1`.id_attribute_group=8 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute ) update ps_product_attribute1 d set d.szerokosc = ( SELECT ceil(name) from `ps_attribute_lang1` LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute where `ps_attribute1`.id_attribute_group=9 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute ) update ps_product_attribute1 d set d.glebokosc = ( SELECT ceil(name) from `ps_attribute_lang1` LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute where `ps_attribute1`.id_attribute_group=10 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute ) !!! MOST IMPORTANT !!! SZEROKOŚĆ update ps_product_attribute1 set ps_product_attribute1.szerokosc = ( SELECT ceil(SUBSTR(name,LOCATE('szer.',name)+5,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute2` WHERE `reference` LIKE '%ega%' GROUP BY id_product) and ceil(SUBSTR(name,LOCATE('szer.',name)+5,4)) > 0 and ps_product_lang1.id_product = ps_product_attribute1.id_product) WYSOKOSC SELECT *, ceil(SUBSTR(name,LOCATE('wys.',name)+5,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) update ps_product_attribute1 set ps_product_attribute1.wysokosc = ( SELECT ceil(SUBSTR(name,LOCATE('wys.',name)+5,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute2` WHERE `reference` LIKE '%ega%' GROUP BY id_product) and ceil(SUBSTR(name,LOCATE('wys.',name)+5,4)) > 0 and ps_product_lang1.id_product = ps_product_attribute1.id_product) GŁĘBOKOŚĆ SELECT name, ceil(SUBSTR(name,LOCATE('komory',name)+6,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) update ps_product_attribute1 set ps_product_attribute1.glebokosc = ( SELECT ceil(SUBSTR(name,LOCATE('komory',name)+6,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute2` WHERE `reference` LIKE '%ega%' GROUP BY id_product) and ceil(SUBSTR(name,LOCATE('komory',name)+6,4)) > 0 and ps_product_lang1.id_product = ps_product_attribute1.id_product) Długość SELECT name, ceil(SUBSTR(name,LOCATE('dł.',name)+4,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) update ps_product_attribute1 set ps_product_attribute1.dlugosc = ( SELECT ceil(SUBSTR(name,LOCATE('dł.',name)+4,4)) FROM `ps_product_lang1` where id_product in (SELECT id_product FROM `ps_product_attribute2` WHERE `reference` LIKE '%ega%' GROUP BY id_product) and ceil(SUBSTR(name,LOCATE('dł.',name)+4,4)) > 0 and ps_product_lang1.id_product = ps_product_attribute1.id_product) // Tworzenie stringa UPDATE `ps_product_attribute1` SET `wysokosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `wysokosc`= "0" UPDATE `ps_product_attribute1` SET `dlugosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `dlugosc`= "0" UPDATE `ps_product_attribute1` SET `szerokosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `szerokosc`= "0" UPDATE `ps_product_attribute1` SET `glebokosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `glebokosc`= "0" !!! UPDATE `ps_product_attribute1` SET `reference2` = CONCAT( REPLACE(reference,'_eco',''),'-',`dlugosc`,'.',`szerokosc`,'.',`glebokosc`,'.',`wysokosc`,'_eco') WHERE `id_product_attribute`=`id_product_attribute` and `reference` LIKE '%ega%' and `reference` LIKE '%eco%' UPDATE `ps_product_attribute1` SET `reference2` = CONCAT(reference,'-',`dlugosc`,'.',`szerokosc`,'.',`glebokosc`,'.',`wysokosc`) WHERE `id_product_attribute`=`id_product_attribute` and `reference` LIKE '%ega%' and `reference` NOT LIKE '%eco%' Produkty nie aktywne egaz ceny -> 0 ! UPDATE `ps_product_shop1` set `price` = 0.000000 , `cena_katalogowa` = 0.000000 where id_product = id_product and active = 0 and id_product in (SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) porównanie update ps_product_attribute1 a set a.dlugosc = (select dlugosc from ps_product_lang1 where id_product=a.id_product) SELECT * FROM `ex_egaz` WHERE typ in (SELECT reference2 FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product) update ps_product_attribute_shop set price= update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where ps_product_attribute1.reference2 LIKE %ex_egaz.typ ) where ps_product_attribute1.id_product = 308 update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where ps_product_attribute1.reference2 LIKE '%ex_egaz.typ' ) where ps_product_attribute1.id_product = 308 update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where SUBSTR(ps_product_attribute1.reference2,5) = ex_egaz.typ ) where ps_product_attribute1.id_product = 308 update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where SUBSTR(ps_product_attribute1.reference2,5) = ex_egaz.typ ) where ps_product_attribute1.id_product = 308 update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where SUBSTR(ps_product_attribute1.reference2,5) = ex_egaz.typ ) where ps_product_attribute1.id_product = 1433 update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where SUBSTR(ps_product_attribute1.reference2,5) = ex_egaz.typ ) where ps_product_attribute1.id_product > 549 and ps_product_attribute1.id_product <560 SELECT * FROM `ps_product_attribute1` WHERE `id_product` = 308 ORDER BY `id_product` ASC update `ps_product_attribute1` set price = (SELECT cena_netto FROM `ex_egaz` where SUBSTR(ps_product_attribute1.reference2,5) = ex_egaz.typ ) where ps_product_attribute1.id_product > 2700