-
Notifications
You must be signed in to change notification settings - Fork 0
/
company update
39 lines (22 loc) · 1.26 KB
/
company update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
UPDATE products p,
(SELECT
ComparisionProductsSnapdeal.Company as Brand,
products.productId as ProductId
FROM products
INNER JOIN
ComparisionProductsSnapdeal ON ComparisionProductsSnapdeal.MasterProductId=products.productId AND
ComparisionProductsSnapdeal.Price>0 AND
ComparisionProductsSnapdeal.Price IS NOT NULL AND
ComparisionProductsSnapdeal.Delivery IS NOT NULL AND
ComparisionProductsSnapdeal.auto_live_status = 'V' AND
ComparisionProductsSnapdeal.InStock = 1
WHERE
products.brand IS NULL
GROUP BY
products.productId
LIMIT 10000
) as leastpricetable
SET
p.brand = leastpricetable.Brand
WHERE
p.productId = leastpricetable.ProductId