Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- INSERT IGNORE INTO yii_doc.price_sku (price_id, pa_id, is_active, comment)
- SELECT sp.id AS price_id
- , pa.id AS pa_id
- , 1
- , 'auto vitrina (IT fix)'
- FROM yii_doc.supplier_price sp
- LEFT JOIN yii_doc.price_sku ps ON ps.price_id = sp.id
- LEFT JOIN yii_doc.prices_all pa_exists ON pa_exists.art_num = sp.art_num
- AND pa_exists.brand_id = sp.brand_id
- LEFT JOIN yii_doc.char_text ct ON ct.text_hash = MD5(sp.art_num)
- LEFT JOIN yii_doc.char_art ca ON ca.ca_char_text_id = ct.id
- LEFT JOIN yii_doc.`char` c ON c.id = ca.ca_char_id
- AND c.cha_type = 't'
- LEFT JOIN yii_doc.prices_all pa ON pa.id = ca.ca_pa_id
- AND pa.brand_id = sp.brand_id
- WHERE sp.isMarketplace = 0
- # 42 - id поставщика витрины
- AND sp.supplier = '42'
- AND ps.price_id IS NULL
- AND pa_exists.id IS NULL
- AND c.id IS NOT NULL
- AND pa.id IS NOT NULL;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement