Facebook
From jo, 6 Years ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 256
  1. 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)
  2.  
  3. 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)
  4.  
  5.  
  6.  
  7.  
  8.  
  9. 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)
  10.  
  11. 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)
  12.  
  13.  
  14. SELECT *,ceil(name) FROM `ps_product_attribute1`
  15. LEFT JOIN `ps_product_attribute_combination` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute
  16. LEFT JOIN `ps_attribute_lang` ON `ps_attribute_lang`.id_attribute = `ps_product_attribute_combination`.id_attribute
  17. LEFT JOIN `ps_attribute` ON `ps_attribute`.id_attribute = `ps_attribute_lang`.id_attribute
  18. where `ps_attribute`.id_attribute_group=8
  19. ORDER BY `ps_product_attribute1`.`dlugosc`  DESC
  20.  
  21.  
  22. update ps_product_attribute1 a set a.dlugosc =
  23. (SELECT ceil(name) FROM `ps_product_attribute1` aa
  24. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  25. LEFT JOIN `ps_attribute_lang1` ON `ps_attribute_lang1`.id_attribute = `ps_product_attribute_combination2`.id_attribute
  26. LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  27. where `ps_attribute1`.id_attribute_group=8 and aa.id_product=a.id_product)
  28.  
  29.  
  30. update ps_product_attribute1 set ps_product_attribute1.dlugosc =(
  31.     SELECT ceil(name) FROM `ps_product_attribute1`
  32. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  33. LEFT JOIN `ps_attribute_lang1` ON `ps_attribute_lang1`.id_attribute = `ps_product_attribute_combination2`.id_attribute
  34. LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  35. where `ps_attribute1`.id_attribute_group=8 and ps_product_attribute1.id_attribute
  36.     )
  37.  
  38.  
  39.  
  40. SELECT *,ceil(name) FROM `ps_product_attribute1`
  41. LEFT JOIN `ps_product_attribute_combination` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute
  42. LEFT JOIN `ps_attribute_lang` ON `ps_attribute_lang`.id_attribute = `ps_product_attribute_combination`.id_attribute
  43. LEFT JOIN `ps_attribute` ON `ps_attribute`.id_attribute = `ps_attribute_lang`.id_attribute
  44. where `ps_attribute`.id_attribute_group=8 and ceil(name)>0
  45. ORDER BY `ceil(name)`  DESC
  46.  
  47.  
  48.  
  49. SELECT id_product FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product
  50.  
  51.  
  52. update ps_product_attribute1 a set a.dlugosc = (select dlugosc from ps_product_lang1 where id_product=a.id_product)
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61. update ps_product_attribute1 d set d.dlugosc =
  62. (
  63. SELECT ceil(name) as dlugosc FROM `ps_product_attribute1` b
  64. LEFT JOIN `ps_product_attribute_combination` ON b.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute
  65. LEFT JOIN `ps_attribute_lang` ON `ps_attribute_lang`.id_attribute = `ps_product_attribute_combination`.id_attribute
  66. LEFT JOIN `ps_attribute` ON `ps_attribute`.id_attribute = `ps_attribute_lang`.id_attribute
  67. where `ps_attribute`.id_attribute_group=8
  68. and d.id_product_attribute = `ps_product_attribute_combination`.id_product_attribute
  69. )
  70.  
  71. SELECT ceil(name) from `ps_attribute_lang1`
  72. LEFT JOIN `ps_attribute` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  73. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute
  74. LEFT JOIN `ps_product_attribute1` ON `ps_product_attribute1`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  75. where `ps_attribute1`.id_attribute_group=8
  76.  
  77.  
  78.  
  79.  
  80.  
  81.  
  82.  
  83. działa !
  84.  
  85.  
  86.  
  87.  
  88.  
  89. update ps_product_attribute1 d set d.wysokosc =
  90. (
  91. SELECT ceil(name) from `ps_attribute_lang1`
  92. LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  93. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute
  94. LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  95. where `ps_attribute1`.id_attribute_group=15 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  96. )
  97.  
  98. update ps_product_attribute1 d set d.dlugosc =
  99. (
  100. SELECT ceil(name) from `ps_attribute_lang1`
  101. LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  102. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute
  103. LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  104. where `ps_attribute1`.id_attribute_group=8 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  105. )
  106.  
  107.  
  108.  
  109. update ps_product_attribute1 d set d.szerokosc =
  110. (
  111. SELECT ceil(name) from `ps_attribute_lang1`
  112. LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  113. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute
  114. LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  115. where `ps_attribute1`.id_attribute_group=9 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  116. )
  117.  
  118.  
  119.  
  120. update ps_product_attribute1 d set d.glebokosc =
  121. (
  122. SELECT ceil(name) from `ps_attribute_lang1`
  123. LEFT JOIN `ps_attribute1` ON `ps_attribute1`.id_attribute = `ps_attribute_lang1`.id_attribute
  124. LEFT JOIN `ps_product_attribute_combination2` ON `ps_product_attribute_combination2`.id_attribute = `ps_attribute1`.id_attribute
  125. LEFT JOIN `ps_product_attribute2` ON `ps_product_attribute2`.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  126. where `ps_attribute1`.id_attribute_group=10 and d.id_product_attribute = `ps_product_attribute_combination2`.id_product_attribute
  127. )
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.  
  137. !!! MOST IMPORTANT !!!
  138.  
  139. SZEROKOŚĆ
  140. update ps_product_attribute1 set ps_product_attribute1.szerokosc = (
  141. 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)
  142.  
  143.  
  144. WYSOKOSC
  145.  
  146. 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)
  147.  
  148.  
  149. update ps_product_attribute1 set ps_product_attribute1.wysokosc = (
  150. 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)
  151.  
  152. GŁĘBOKOŚĆ
  153. 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)
  154.  
  155. update ps_product_attribute1 set ps_product_attribute1.glebokosc = (
  156. 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)
  157.  
  158.  
  159. Długość
  160.  
  161. 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)
  162.  
  163. update ps_product_attribute1 set ps_product_attribute1.dlugosc = (
  164. 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)
  165.  
  166.  
  167.  
  168.  
  169. // Tworzenie stringa
  170.  
  171.  
  172. UPDATE `ps_product_attribute1` SET `wysokosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `wysokosc`= "0"
  173.  
  174. UPDATE `ps_product_attribute1` SET `dlugosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `dlugosc`= "0"
  175.  
  176. UPDATE `ps_product_attribute1` SET `szerokosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `szerokosc`= "0"
  177.  
  178. UPDATE `ps_product_attribute1` SET `glebokosc` = "B" WHERE `id_product_attribute`=`id_product_attribute` and `glebokosc`= "0"
  179.  
  180.  
  181.  
  182. !!!
  183. 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%'
  184.  
  185.  
  186. 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%'  
  187.  
  188.  
  189.  
  190. Produkty nie aktywne egaz ceny -> 0 !
  191.  
  192.  
  193.  
  194. 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)
  195.  
  196.  
  197.  
  198.  
  199. porównanie
  200.  
  201. update ps_product_attribute1 a set a.dlugosc = (select dlugosc from ps_product_lang1 where id_product=a.id_product)
  202.  
  203.  
  204.  
  205. SELECT * FROM `ex_egaz` WHERE typ in (SELECT reference2 FROM `ps_product_attribute1` WHERE `reference` LIKE '%ega%' GROUP BY id_product)
  206.  
  207.  
  208.  
  209.  
  210. update ps_product_attribute_shop set price=
  211.  
  212.  
  213.  
  214.  
  215.  
  216. 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
  217. 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
  218.  
  219.  
  220.  
  221.  
  222. 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
  223.  
  224.  
  225. 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
  226.  
  227. 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
  228.  
  229.  
  230. 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
  231.  
  232. SELECT * FROM `ps_product_attribute1` WHERE `id_product` = 308 ORDER BY `id_product` ASC
  233. 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